Moved web only files to web source root

This commit is contained in:
WolverinDEV 2019-05-20 19:28:20 +02:00
parent 40a56ed2f2
commit 47c43ea428
8 changed files with 24 additions and 24 deletions

View file

@ -660,8 +660,10 @@ class ConnectionHandler {
acquire_recorder(voice_recoder: RecorderProfile, update_control_bar: boolean) {
const vconnection = this.serverConnection.voice_connection();
if(vconnection)
vconnection.acquire_voice_recorder(voice_recoder);
this.update_voice_status(undefined);
(vconnection ? vconnection.acquire_voice_recorder(voice_recoder) : Promise.resolve()).catch(error => {
console.error(tr("Failed to acquire recorder (%o)"), error);
}).then(() => {
this.update_voice_status(undefined);
});
}
}

View file

@ -82,7 +82,7 @@ namespace connection {
abstract unregister_client(client: VoiceClient) : Promise<void>;
abstract voice_recorder() : RecorderProfile;
abstract acquire_voice_recorder(recorder: RecorderProfile | undefined);
abstract acquire_voice_recorder(recorder: RecorderProfile | undefined) : Promise<void>;
}
}

View file

@ -591,12 +591,7 @@ const loader_javascript = {
"js/permission/GroupManager.js",
//Load audio
"js/voice/VoiceHandler.js",
"js/voice/AudioResampler.js",
"js/voice/VoiceClient.js",
"js/voice/RecorderBase.js",
"js/voice/JavascriptRecorder.js",
"js/voice/RecorderProfile.js",
//Load codec
@ -633,7 +628,12 @@ const loader_javascript = {
await loader.load_scripts([
["js/audio/AudioPlayer.js"],
["js/audio/WebCodec.js"],
["js/WebPPTListener.js"]
["js/WebPPTListener.js"],
"js/voice/AudioResampler.js",
"js/voice/JavascriptRecorder.js",
"js/voice/VoiceHandler.js",
"js/voice/VoiceClient.js",
]);
},
load_scripts_debug_client: async () => {

View file

@ -424,9 +424,9 @@ loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, {
}
},
priority: 100
})
});
loader.register_task(loader.Stage.LOADED, {
loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, {
name: "app starter",
function: async () => {
try {
@ -443,6 +443,6 @@ loader.register_task(loader.Stage.LOADED, {
displayCriticalError("Failed to boot app function:<br>" + ex);
}
},
priority: 10
priority: 100
});

View file

@ -292,13 +292,11 @@ namespace audio {
async start() {
this._state = InputState.INITIALIZING;
if(!this._current_device) {
if(!this._current_device)
return;
}
if(!this._audio_context) {
if(!this._audio_context)
return;
}
try {
const media_function = getUserMediaFunction();
@ -326,7 +324,6 @@ namespace audio {
this._initialize_filters();
this._state = InputState.RECORDING;
} catch(error) {
console.warn(tr("Failed to start recorder (%o)"), error);
this._state = InputState.PAUSED;
throw error;
}

View file

@ -190,14 +190,15 @@ namespace audio {
if(!this.javascript_encoding_supported()) return;
}
acquire_voice_recorder(recorder: RecorderProfile | undefined, enforce?: boolean) {
async acquire_voice_recorder(recorder: RecorderProfile | undefined, enforce?: boolean) {
if(this._audio_source === recorder && !enforce)
return;
if(recorder)
recorder.unmount(); /* FIXME: Await promise? */
await recorder.unmount();
if(this._audio_source)
this._audio_source.unmount();
await this._audio_source.unmount();
this.handleVoiceEnded();
this._audio_source = recorder;
@ -217,7 +218,7 @@ namespace audio {
if(!this.local_audio_stream)
this.setup_native(); /* requires initialized audio */
recorder.input.set_consumer({
await recorder.input.set_consumer({
type: audio.recorder.InputConsumerType.NODE,
callback_node: node => {
if(!this.local_audio_stream)
@ -233,7 +234,7 @@ namespace audio {
}
} as audio.recorder.NodeInputConsumer);
} else {
recorder.input.set_consumer({
await recorder.input.set_consumer({
type: audio.recorder.InputConsumerType.CALLBACK,
callback_audio: buffer => this.handleVoiceData(buffer, false)
} as audio.recorder.CallbackInputConsumer);
@ -538,7 +539,7 @@ namespace audio {
private on_recoder_yield() {
console.log("Lost recorder!");
this._audio_source = undefined;
this.acquire_voice_recorder(undefined, true);
this.acquire_voice_recorder(undefined, true); /* we can ignore the promise because we should finish this directly */
}
connected(): boolean {