toms fix for player timeout bug

This commit is contained in:
zeppi 2021-06-11 13:32:56 -04:00 committed by jessopb
parent e8d352cc4c
commit eff948f786

View file

@ -553,22 +553,17 @@ export default React.memo<Props>(function VideoJs(props: Props) {
} }
let type = sourceType; let type = sourceType;
let finalSource = source;
// override type if we receive an .m3u8 (transcoded mp4) // override type if we receive an .m3u8 (transcoded mp4)
if (response && response.redirected && response.url && response.url.endsWith('m3u8')) { if (response && response.redirected && response.url && response.url.endsWith('m3u8')) {
type = 'application/x-mpegURL'; type = 'application/x-mpegURL';
finalSource = response.url;
} }
// Update player poster // Update player poster
// note: the poster prop seems to return null usually. // note: the poster prop seems to return null usually.
if (poster) player.poster(poster); if (poster) player.poster(poster);
// Update player source
player.src({
src: source,
type: type,
});
// set playsinline for mobile // set playsinline for mobile
player.children_[0].setAttribute('playsinline', ''); player.children_[0].setAttribute('playsinline', '');
@ -579,7 +574,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// Update player source // Update player source
player.src({ player.src({
src: source, src: finalSource,
type: type, type: type,
}); });