video: catch quality change errors

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/888/head
Varun Patil 2023-10-24 16:51:29 -07:00
parent 6d1fa55a0f
commit 3106108f04
1 changed files with 35 additions and 28 deletions

View File

@ -341,6 +341,10 @@ class VideoContentSetup {
options: qualityNums,
forced: true,
onChange: (quality: number) => {
// Changing the quality sometimes throws strange
// DOMExceptions; don't let this stop Plyr from being
// constructed altogether.
try {
qualityList = content.videojs?.qualityLevels?.();
if (!qualityList || !content.videojs) return;
@ -374,6 +378,9 @@ class VideoContentSetup {
pixels === quality || // exact match
(label?.includes('max.m3u8') && quality === -1); // max
}
} catch (e) {
console.error('Error changing quality', e);
}
},
};
}