Fixed some audio related issues with the client
This commit is contained in:
parent
b4433a0609
commit
eae62b98f7
4 changed files with 21 additions and 37 deletions
|
@ -40,7 +40,7 @@ namespace events {
|
||||||
off(handler_or_events, handler?) {
|
off(handler_or_events, handler?) {
|
||||||
if(typeof handler_or_events === "function") {
|
if(typeof handler_or_events === "function") {
|
||||||
for(const key of Object.keys(this.handler))
|
for(const key of Object.keys(this.handler))
|
||||||
this.handler[key].remove(handler);
|
this.handler[key].remove(handler_or_events);
|
||||||
} else {
|
} else {
|
||||||
if(!Array.isArray(handler_or_events))
|
if(!Array.isArray(handler_or_events))
|
||||||
handler_or_events = [handler_or_events];
|
handler_or_events = [handler_or_events];
|
||||||
|
|
|
@ -147,15 +147,20 @@ async function initialize_app() {
|
||||||
|
|
||||||
if(!audio.player.initialize())
|
if(!audio.player.initialize())
|
||||||
console.warn(tr("Failed to initialize audio controller!"));
|
console.warn(tr("Failed to initialize audio controller!"));
|
||||||
if(audio.player.set_master_volume)
|
|
||||||
audio.player.set_master_volume(settings.global(Settings.KEY_SOUND_MASTER) / 100);
|
audio.player.on_ready(() => {
|
||||||
else
|
if(audio.player.set_master_volume)
|
||||||
log.warn(LogCategory.GENERAL, tr("Client does not support audio.player.set_master_volume()... May client is too old?"));
|
audio.player.on_ready(() => audio.player.set_master_volume(settings.global(Settings.KEY_SOUND_MASTER) / 100));
|
||||||
if(audio.recorder.device_refresh_available())
|
else
|
||||||
await audio.recorder.refresh_devices();
|
log.warn(LogCategory.GENERAL, tr("Client does not support audio.player.set_master_volume()... May client is too old?"));
|
||||||
|
if(audio.recorder.device_refresh_available())
|
||||||
|
audio.recorder.refresh_devices();
|
||||||
|
});
|
||||||
|
|
||||||
default_recorder = new RecorderProfile("default");
|
default_recorder = new RecorderProfile("default");
|
||||||
await default_recorder.initialize();
|
default_recorder.initialize().catch(error => {
|
||||||
|
log.error(LogCategory.AUDIO, tr("Failed to initialize default recorder: %o"), error);
|
||||||
|
});
|
||||||
|
|
||||||
sound.initialize().then(() => {
|
sound.initialize().then(() => {
|
||||||
log.info(LogCategory.AUDIO, tr("Sounds initialized"));
|
log.info(LogCategory.AUDIO, tr("Sounds initialized"));
|
||||||
|
|
0
shared/js/ui/modal/ModalPlaylistManage.ts
Normal file
0
shared/js/ui/modal/ModalPlaylistManage.ts
Normal file
|
@ -51,8 +51,6 @@ class RecorderProfile {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.volatile = typeof(volatile) === "boolean" ? volatile : false;
|
this.volatile = typeof(volatile) === "boolean" ? volatile : false;
|
||||||
|
|
||||||
this.initialize_input();
|
|
||||||
|
|
||||||
this._ppt_hook = {
|
this._ppt_hook = {
|
||||||
callback_release: () => {
|
callback_release: () => {
|
||||||
if(this._ppt_timeout)
|
if(this._ppt_timeout)
|
||||||
|
@ -80,18 +78,11 @@ class RecorderProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize() : Promise<void> {
|
async initialize() : Promise<void> {
|
||||||
await this.load();
|
audio.player.on_ready(async () => {
|
||||||
await this.reinitialize_filter();
|
this.initialize_input();
|
||||||
//Why we started directly after initialize?
|
await this.load();
|
||||||
//After we connect to a server the ConnectionHandler will automatically
|
await this.reinitialize_filter();
|
||||||
//start the VoiceRecorder as soon we've a voice bridge.
|
});
|
||||||
/*
|
|
||||||
try {
|
|
||||||
await this.input.start();
|
|
||||||
} catch(error) {
|
|
||||||
console.warn(tr("Failed to start recorder after initialize (%o)"), error);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private initialize_input() {
|
private initialize_input() {
|
||||||
|
@ -107,19 +98,6 @@ class RecorderProfile {
|
||||||
if(this.callback_stop)
|
if(this.callback_stop)
|
||||||
this.callback_stop();
|
this.callback_stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
this.input.callback_state_change = () => {
|
|
||||||
const new_state = this.input.current_state() === audio.recorder.InputState.RECORDING || this.input.current_state() === audio.recorder.InputState.DRY;
|
|
||||||
|
|
||||||
if(new_state === this.record_supported)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.record_supported = new_state;
|
|
||||||
if(this.callback_support_change)
|
|
||||||
this.callback_support_change();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async load() {
|
private async load() {
|
||||||
|
@ -163,12 +141,13 @@ class RecorderProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
private save(enforce?: boolean) {
|
private save(enforce?: boolean) {
|
||||||
if(enforce || !this.volatile) {
|
if(enforce || !this.volatile)
|
||||||
settings.changeGlobal(Settings.FN_PROFILE_RECORD(this.name), this.config);
|
settings.changeGlobal(Settings.FN_PROFILE_RECORD(this.name), this.config);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async reinitialize_filter() {
|
private async reinitialize_filter() {
|
||||||
|
if(!this.input) return;
|
||||||
|
|
||||||
this.input.clear_filter();
|
this.input.clear_filter();
|
||||||
if(this._ppt_hook_registered) {
|
if(this._ppt_hook_registered) {
|
||||||
ppt.unregister_key_hook(this._ppt_hook);
|
ppt.unregister_key_hook(this._ppt_hook);
|
||||||
|
|
Loading…
Add table
Reference in a new issue