在做小程序时,遇到播放视频,希望直接点击视频便全屏播放,uniapp 文档上也有介绍 https://uniapp.dcloud.io/api/media/video-context?id=createvideocontext

重要的事情说三遍 this this this,记得createVideoContext第一个参数为video的ID,第二个参数组件实例this

this.videoContext = uni.createVideoContext(id,this);
this.videoContext.requestFullScreen();

 

<video ></video>

 

退出全屏时,停止播放

fullscreenchange (e){
   if(!e.detail.fullScreen){
      this.videoContext.stop()
   }
}

 

相关文章:

  • 2022-01-17
  • 2022-12-23
  • 2021-05-15
  • 2021-12-23
  • 2021-12-19
  • 2021-10-15
  • 2021-10-10
  • 2021-05-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
相关资源
相似解决方案