Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public play(): void {
super.play();
if (this.getState() !== Decoder.STATE.PLAYING || !this.screenInfo) {
return;
}
if (!this.converter) {
const fps = 60;
// for some reason stream work only with fps === 60
// if (this.videoSettings) {
// fps = this.videoSettings.frameRate;
// }
const fpf = this.fpf;
console.log(`Create new VideoConverter(fps=${fps}, fpf=${fpf})`);
this.converter = new VideoConverter(this.tag, fps, fpf);
}
this.converter.play();
}
} else {
let data;
try {
data = JSON.parse(e.data);
} catch (e) {
console.log(e.data);
return;
}
switch (data.type) {
case CONST.MESSAGE_TYPE_STREAM_INFO:
if (converter) {
converter.appendRawData(new Uint8Array([]));
converter.pause();
}
streamInfo = data;
converter = new VideoConverter(element, data.frameRate, DEFAULT_FPF);
converter.play();
break;
case CONST.MESSAGE_TYPE_TEXT:
console.log(data.message);
break;
default:
console.log(e.data);
}
}
}, false);