mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-02 21:33:52 +02:00
Add some try-catch
This commit is contained in:
@@ -95,6 +95,7 @@ export class InputVideoTrack extends InputTrack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async canDecode() {
|
async canDecode() {
|
||||||
|
try {
|
||||||
const decoderConfig = await this._backing.getDecoderConfig();
|
const decoderConfig = await this._backing.getDecoderConfig();
|
||||||
if (!decoderConfig) {
|
if (!decoderConfig) {
|
||||||
return false;
|
return false;
|
||||||
@@ -102,6 +103,10 @@ export class InputVideoTrack extends InputTrack {
|
|||||||
|
|
||||||
const support = await VideoDecoder.isConfigSupported(decoderConfig);
|
const support = await VideoDecoder.isConfigSupported(decoderConfig);
|
||||||
return support.supported === true;
|
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() {
|
async canDecode() {
|
||||||
|
try {
|
||||||
const decoderConfig = await this._backing.getDecoderConfig();
|
const decoderConfig = await this._backing.getDecoderConfig();
|
||||||
if (!decoderConfig) {
|
if (!decoderConfig) {
|
||||||
return false;
|
return false;
|
||||||
@@ -162,5 +168,9 @@ export class InputAudioTrack extends InputTrack {
|
|||||||
const support = await AudioDecoder.isConfigSupported(decoderConfig);
|
const support = await AudioDecoder.isConfigSupported(decoderConfig);
|
||||||
return support.supported === true;
|
return support.supported === true;
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error during decodability check:', error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user