Support for HLS

This commit is contained in:
2021-03-24 08:17:36 +01:00
parent 360952706d
commit c28f3ef9ae
2 changed files with 27 additions and 9 deletions
+15 -7
View File
@@ -238,7 +238,7 @@ function createRepresentationButtons(player, menuButton = undefined) {
let hls = player.tech({IWillNotUseThisInPlugins: true}).hls;
if (hls === undefined) {
if (hls === undefined || hls.representations === undefined) {
setTimeout(() => createRepresentationButtons(player, menuButton), 500);
return menuButton;
}
@@ -365,10 +365,16 @@ vd.setup = function(video, args) {
}
let player = videojs(video);
player.src({
src,
type: 'application/dash+xml'
});
if (src.endsWith('.mpd')) {
player.src({
src,
type: 'application/dash+xml'
});
} else {
player.src({
src,
});
}
if (args.focus === true) {
player.focus();
@@ -528,8 +534,10 @@ vd.setup = function(video, args) {
controlBar.removeChild(fullscreenButton);
let menuButton = createRepresentationButtons(player);
let speedButton = createSpeedButtons(player);
controlBar.addChild(speedButton, {});
if (player.getAttribute('disable-speed') == undefined) {
let speedButton = createSpeedButtons(player);
controlBar.addChild(speedButton, {});
}
controlBar.addChild(menuButton, {});
controlBar.addChild(fullscreenButton, {});