uniapp video 标签,点击进入全屏播放,退出全屏,停止播放,暂停播放
【代码】uniapp video 标签,点击进入全屏播放,退出全屏,停止播放,暂停播放。
·
<video
:src="url"
controls
id="videoId"
@play="play"
@fullscreenchange="fullscreenchange">
</video>
// 播放时进入全屏 play(index) { let videoContext = uni.createVideoContext('videoId', this) videoContext.requestFullScreen() }, //退出全屏时暂停 fullscreenchange(e) { if (!e.detail.fullScreen) { uni.createVideoContext('videoId', this).pause(); } }, //退出全屏时停止 fullscreenchange (e){ if(!e.detail.fullScreen){ this.videoContext.stop() } }
更多推荐
已为社区贡献10条内容
所有评论(0)