【发布时间】:2019-03-10 06:14:57
【问题描述】:
我想在下面的 html5 代码中添加全屏模式 建议我如何更改给定的代码,我在此脚本中添加全屏代码时遇到问题
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video"></video>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('https://weblive.goonj.pk/dawnnewsweb_360p/index.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
// When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element throught the `src` property.
// This is using the built-in support of the plain video element, without using hls.js.
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = 'https://weblive.goonj.pk/dawnnewsweb_360p/index.m3u8';
video.addEventListener('canplay',function() {
video.play();
});
}
</script>
【问题讨论】:
-
没有先生的代码已经写了,但我不知道输入全屏模式代码的顺序
-
请关闭大写锁定 - 被认为是大喊大叫且难以阅读。为什么标记为
java(代码:myDevice.setFullScreenWindow(myWindow);)?检查help center -
好的,关闭,我标记了 java,因为它与 java..var 脚本有关,这就是为什么..
-
感谢您的代码,但要在哪里添加它才能使其正常工作
标签: javascript html