video 按钮全屏

news/2025/2/3 22:43:28/

 微信小程序方法:

<video class="my-video1" id="myVideo1" bindfullscreenchange="screenChange" src="{{ossPath+'video/dunhuang-video202201051033.mp4'}}" controls='controls'></video>
点击进入全屏:showVideo1() {let videoContext = wx.createVideoContext('myVideo1');  //获取video的domvideoContext.requestFullScreen({ direction: 90 });videoContext.play() //视频播放
},

另一种方法

  <video bindtap="fullscreen" id="myVideo" style="width: 100rpx; height: 100rpx;" src="http://jixiequan-miniapp.oss-cn-beijing.aliyuncs.com/attach/video/2023/08/30/fd618202308301522291090.mp4"/>//按钮事件fullscreen() {let videoContext = wx.createVideoContext('myVideo');  //获取video的domvideoContext.requestFullScreen({ direction: 90 });videoContext.play() //视频播放}

监听是否退出或进入全屏:(在video上绑定bindfullscreenchange事件)

screenChange(e) {let fullScreen = e.detail.fullScreen //值true为进入全屏,false为退出全屏let videoContext = wx.createVideoContext('myVideo1');
},


h5方法:
点击进入全屏:

<video id="product1" controls="false" webview.allowsInlineMediaPlayback=YES; x5-video-player-type="h5" x5-video-player-fullscreen="true" x5-video-orientation="portraint" :src="videoPath+'qhtalent202112/product-info.mp4'">
</video>
//判断进入退出全屏
checkIsFullScreen() {var isFullScreen = document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen;return isFullScreen == undefined ? false : isFullScreen;
},
// 全屏
Screen(element) {if (element.requestFullscreen) {element.requestFullscreen();} else if (element.mozRequestFullScreen) {element.mozRequestFullScreen();} else if (element.msRequestFullscreen) {element.msRequestFullscreen();} else if (element.oRequestFullscreen) {element.oRequestFullscreen();} else if (element.webkitRequestFullscreen) {element.webkitRequestFullScreen();} else {var requestFullscreen =document.documentElement.requestFullscreen ||document.documentElement.webkitRequestFullscreen ||document.documentElement.mozRequestFullscreen ||document.documentElement.requestFullScreen ||document.documentElement.webkitRequestFullScreen ||document.documentElement.mozRequestFullScreen;if (requestFullscreen) {requestFullscreen.call(document.documentElement);}//ios不处理,自动就会全屏}element.play()
},
//点读笔播放视频
productBtn() {let product1 = document.getElementById('product1')product1.play()this.Screen(product1)
},
document.addEventListener('fullscreenchange', () => {if (this.checkIsFullScreen()) {this.productPlay = trueconsole.log("进入全屏");} else {console.log("退出全屏");this.productPlay = falsedocument.getElementById('product1').pause()}
});

http://www.ppmy.cn/news/1081595.html

相关文章

UI设计开发原则

一、一致性原则 坚持以用户体验为中心设计原则&#xff0c;界面直观、简洁&#xff0c;操作方便快捷&#xff0c;用户接触软件后对界面上对应的功能一目了然、不需要太多培训就可以方便使用本应用系统。 1、字体 保持字体及颜色一致&#xff0c;避免一套主题出现多个字体&am…

20230830工作心得:巧用标记位和For循环遍历

1 巧用标记位和For循环遍历 您可以使用一个 Map<String, List<xxx>> 类型的数据结构来根据手机号分组并保存多条线索。然后&#xff0c;可以按照以下方式进行操作&#xff1a; 1. 设置一个标志位&#xff0c;比如一个布尔变量&#xff0c;用于记录是否已经成功推…

C和SystemVerilog联合仿真

想要联合仿真一个c程序和verilog表示的硬件&#xff0c;可以用如下方法&#xff08;DPI&#xff09;&#xff1a; 先写一个.c文件funcs.c #include <stdio.h> #include "svdpi.h"extern int sayHello();void something() {printf("something\n");s…

vr健康管理服务情景化教学弥补现代医学教学中的诸多不足之处

高职高专临床医学院校以培养岗位胜任力为目的&#xff0c;该专业是一门专业性、实践性较强的医学学科&#xff0c;要求培养出来的学生具有较强的临床实践能力&#xff0c;医学生所学的全部知识&#xff0c;都应与实践相结合&#xff0c;解决临床的实际问题&#xff0c;为患者解…

postgresql-多表连接

postgresql-多表连接 内连接查询左外连接查询右外连接查询全外连接查询交叉连接查询简写 总结 内连接查询 内连接用于返回两个表中匹配的数据行&#xff0c;使用关键字INNER JOIN表示&#xff0c;也可以简写成JOIN&#xff1b; selecte.first_name ,d.department_id fromcps…

【半监督医学图像分割】2022-MedIA-UWI

【半监督医学图像分割】2022-MedIA-UWI 论文题目&#xff1a;Semi-supervise d me dical image segmentation via a triple d-uncertainty guided mean teacher model with contrastive learning 中文题目&#xff1a;基于对比学习的三维不确定性指导平均教师模型的半监督图像分…

设备数据采集的挑战与机遇

导 读 ( 文/ 1661 ) 在现代制造业中&#xff0c;数据是实现高效、质量和盈利的关键驱动力。工厂设备数据采集是一种通过收集、分析和利用设备和流程数据&#xff0c;以提高生产效率、质量和可靠性的方法。 工厂设备数据可以提供有关设备性能、效率、健康状况和生产状况的…

掌握Gitflow的一些进阶用法

1、自定义分支命名约定&#xff1a; 默认情况下&#xff0c;GitFlow使用一套分支命名约定&#xff0c;如feature/、release/和hotfix/等前缀。然而&#xff0c;你可以根据项目的需求自定义分支名称。例如&#xff0c;你可以在分支名称中包含项目、功能或团队成员的信息&#x…