Some bugfixing
parent
8a1b715bfb
commit
e1dd532205
|
@ -1,4 +1,8 @@
|
|||
# Changelog:
|
||||
* **02.09.20**
|
||||
- Fixed web client hangup on no device error
|
||||
- Improved default recorder device detection (selectes by default the best device)
|
||||
|
||||
* **31.08.20**
|
||||
- Reworked the audio decode system
|
||||
- Improved audio decode performance
|
||||
|
|
|
@ -40,6 +40,7 @@ export interface IDevice {
|
|||
}
|
||||
export namespace IDevice {
|
||||
export const NoDeviceId = "none";
|
||||
export const DefaultDeviceId = "default";
|
||||
}
|
||||
|
||||
export type PermissionState = "granted" | "denied" | "unknown";
|
||||
|
|
|
@ -75,7 +75,7 @@ export interface AbstractInput {
|
|||
* If the target device is unknown than it should return EDEVICEUNKNOWN on start.
|
||||
* After changing the device, the input state falls to InputState.PAUSED.
|
||||
*/
|
||||
setDeviceId(device: string | undefined) : Promise<void>;
|
||||
setDeviceId(device: string) : Promise<void>;
|
||||
|
||||
currentConsumer() : InputConsumer | undefined;
|
||||
setConsumer(consumer: InputConsumer) : Promise<void>;
|
||||
|
|
|
@ -165,7 +165,11 @@ export class RecorderProfile {
|
|||
|
||||
/* apply initial config values */
|
||||
this.input.setVolume(this.config.volume / 100);
|
||||
await this.input.setDeviceId(this.config.device_id);
|
||||
if(this.config.device_id) {
|
||||
await this.input.setDeviceId(this.config.device_id);
|
||||
} else {
|
||||
await this.input.setDeviceId(IDevice.DefaultDeviceId);
|
||||
}
|
||||
}
|
||||
|
||||
private save() {
|
||||
|
|
|
@ -203,17 +203,22 @@ class JavascriptInput implements AbstractInput {
|
|||
if(this.state != InputState.PAUSED)
|
||||
return;
|
||||
|
||||
return await (this.startPromise = this.doStart());
|
||||
/* do it async since if the doStart fails on the first iteration, we're setting the start promise, after it's getting cleared */
|
||||
return await (this.startPromise = Promise.resolve().then(() => this.doStart()));
|
||||
}
|
||||
|
||||
private async doStart() : Promise<InputStartResult> {
|
||||
try {
|
||||
if(this.state != InputState.PAUSED)
|
||||
if(this.state != InputState.PAUSED) {
|
||||
throw tr("recorder already started");
|
||||
}
|
||||
|
||||
this.state = InputState.INITIALIZING;
|
||||
if(!this.deviceId) {
|
||||
throw tr("invalid device");
|
||||
let deviceId;
|
||||
if(this.deviceId === IDevice.NoDeviceId) {
|
||||
throw tr("no device selected");
|
||||
} else if(this.deviceId === IDevice.DefaultDeviceId) {
|
||||
deviceId = undefined;
|
||||
}
|
||||
|
||||
if(!this.audioContext) {
|
||||
|
@ -221,7 +226,7 @@ class JavascriptInput implements AbstractInput {
|
|||
return;
|
||||
}
|
||||
|
||||
const requestResult = await requestMediaStream(this.deviceId, undefined);
|
||||
const requestResult = await requestMediaStream(deviceId, undefined);
|
||||
if(!(requestResult instanceof MediaStream)) {
|
||||
this.state = InputState.PAUSED;
|
||||
return requestResult;
|
||||
|
@ -292,7 +297,7 @@ class JavascriptInput implements AbstractInput {
|
|||
}
|
||||
|
||||
|
||||
async setDeviceId(deviceId: string | undefined) {
|
||||
async setDeviceId(deviceId: string) {
|
||||
if(this.deviceId === deviceId)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue