Fix HLS player on mobile
This commit is contained in:
parent
9bb541bec7
commit
930e1b939a
1 changed files with 5 additions and 2 deletions
|
@ -20,6 +20,8 @@ type Metadata = {
|
||||||
|
|
||||||
type HookFn = (player: videojs.Player, hljs: Hlsjs) => void
|
type HookFn = (player: videojs.Player, hljs: Hlsjs) => void
|
||||||
|
|
||||||
|
let alreadyRegistered = false
|
||||||
|
|
||||||
const registerSourceHandler = function (vjs: typeof videojs) {
|
const registerSourceHandler = function (vjs: typeof videojs) {
|
||||||
if (!Hlsjs.isSupported()) {
|
if (!Hlsjs.isSupported()) {
|
||||||
logger.warn('Hls.js is not supported in this browser!')
|
logger.warn('Hls.js is not supported in this browser!')
|
||||||
|
@ -33,8 +35,9 @@ const registerSourceHandler = function (vjs: typeof videojs) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Already registered
|
if (alreadyRegistered) return
|
||||||
if ((html5 as any).canPlaySource({ type: 'application/x-mpegURL' })) return
|
|
||||||
|
alreadyRegistered = true;
|
||||||
|
|
||||||
// FIXME: typings
|
// FIXME: typings
|
||||||
(html5 as any).registerSourceHandler({
|
(html5 as any).registerSourceHandler({
|
||||||
|
|
Loading…
Reference in a new issue