简体   繁体   English

如何在 Html5 中添加全屏模式

[英]How To Add Full Screen Mode In A Html5

I want to add fullscreen mode in below html5 code Suggest me how I can make changes in the given code, I am facing problem in adding the fullscreen code in this script我想在下面的 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 (ie .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>

尝试制作一个带有脚本的按钮元素,该脚本在单击按钮时运行此代码

video.setFullScreenWindow()

The Fullscreen API adds methods to present a specific Element (and its descendants) in full-screen mode, and to exit full-screen mode once it is no longer needed. Fullscreen API 添加了以全屏模式呈现特定元素(及其后代)的方法,并在不再需要时退出全屏模式。

try Element.requestFullscreen(options);尝试 Element.requestFullscreen(options);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在单个HTML5全屏模式下显示2个视频 - How to show 2 videos in single HTML5 Full-screen mode 禁用HTML5视频全屏模式 - Disable HTML5 video full screen mode HTML5视频在全屏模式下检测按键 - HTML5 video detect keypress in full screen mode HTML5移动键盘涵盖了全屏模式下的输入 - HTML5 mobile keyboard covers the input in Full screen mode 在iOS / iPad上进入全屏模式时,如何停止HTML5视频播放器? - How to stop a HTML5 video player when it enters the full screen mode on iOS / iPads? 如何为iOS全屏HTML5视频添加自定义控件? - How can I add custom controls to Full Screen Html5 Video for iOS? 按下用于视频而不用于弹出窗口的esc按钮后,如何以全屏模式打开包含HTML5视频的引导弹出窗口? - How to keep the bootstrap popup opened containing HTML5 video on full-screen mode after pressing esc button intended for the video not for the popup? React - 如何在 html5 中捕获全屏视频请求? - React - how to capture full screen video request in html5? 如何使这个HTML5画布脚本全屏? - How to make this HTML5 canvas script to full screen? 在 iframe 中嵌入 HTML5 游戏,并能够在不同域上切换到全屏模式 - Embed HTML5 games in iframe with ability to switch to full screen mode on different domain
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM