Files
VokaHTMLPlayer/demo/index_hls_live.html
2025-06-25 22:43:18 +03:00

99 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script language="JavaScript" src="./distribution/vokaPlayer.global.js"></script>
</head>
<body>
<h1>Hello world</h1>
<div id="my-video"/>
<script language="JavaScript">
var player = spbtvplayer('my-video', {
features: {
api: true,
drm: false,
metrics: true
},
apiConfig: {
channelId: 'hls-live-998f5396-c9dd-4a1e-82c7-0aec53',
urlGetParams: 'minheight=400',
clientId: null,
movieId: null,
episodeId: null,
newsId: null,
// apiHost: 'localhost:8080',
},
uiConfig: {
initAsLive: true
},
globalOpts: {
uiLanguage: 'ru'
},
streamOpts: {
autoplay: true
},
controls: {
externalSubtitles: {
url: "https://raw.githubusercontent.com/videojs/video.js/c7298d40a4632a6e9dfcd5a2f5cc3bbe92a78744/docs/examples/elephantsdream/captions.ru.vtt",
lang: 'ru'
},
zoomButton: {
isVisible: true,
enable: true,
},
editing: {
enable: true,
},
},
});
player.afterInitialize(() => {
console.log("Inited 1")
})
player.addEventListener('play', onPlay, window)
player.addEventListener('pause', onPause, window)
player.addEventListener('canplay', onCanPlay, window)
player.addEventListener('controlbarShow', onControlsShow, window)
player.addEventListener('controlbarHide', oncontrolsHide, window)
function onPlay() { console.log("on PLAY") }
function onPause() { console.log("on PAUSE") }
function onCanPlay() { console.log("on CANPLAY") }
function onControlsShow() { console.log("on onControlsShow") }
function oncontrolsHide() { console.log("on oncontrolsHide") }
//
function controlBarHide() {
player.setControlbarVisibility(false)
}
function controlBarShow() {
player.setControlbarVisibility(true)
}
function changeQualityAuto() {
player.setSelectedVideoQuality(-1)
}
function changeQualityLowest() {
player.setSelectedVideoQuality(0)
}
function changeQualityBest() {
var quality = player.getVideoQualityList()
player.setSelectedVideoQuality(quality.length - 1)
}
</script>
<button onclick="controlBarShow()" type="button">SHOW CONTROL BAR</button>
<button onclick="controlBarHide()" type="button">HIDE CONTROL BAR</button>
<button onclick="changeQualityAuto()" type="button">AUTO QUALITY</button>
<button onclick="changeQualityLowest()" type="button">LOWEST QUALITY</button>
<button onclick="changeQualityBest()" type="button">BEST QUALITY</button>
</body>
</html>