Add some try-catch

This commit is contained in:
Vanilagy
2025-01-02 23:47:50 +01:00
parent 8db8f10a1e
commit 676ceb7df1
+10
View File
@@ -95,6 +95,7 @@ export class InputVideoTrack extends InputTrack {
}
async canDecode() {
try {
const decoderConfig = await this._backing.getDecoderConfig();
if (!decoderConfig) {
return false;
@@ -102,6 +103,10 @@ export class InputVideoTrack extends InputTrack {
const support = await VideoDecoder.isConfigSupported(decoderConfig);
return support.supported === true;
} catch (error) {
console.error('Error during decodability check:', error);
return false;
}
}
}
@@ -151,6 +156,7 @@ export class InputAudioTrack extends InputTrack {
}
async canDecode() {
try {
const decoderConfig = await this._backing.getDecoderConfig();
if (!decoderConfig) {
return false;
@@ -162,5 +168,9 @@ export class InputAudioTrack extends InputTrack {
const support = await AudioDecoder.isConfigSupported(decoderConfig);
return support.supported === true;
}
} catch (error) {
console.error('Error during decodability check:', error);
return false;
}
}
}