html52.com
我爱小程序-开发者交流社区

云点播短视频播放器 在组件中使用 wx.createVideoContext 不能操作视频

问题类型 插件 AppID 插件版本号 AppID 操作系统 微信版本 基础库版本
Bug wx116d0dd5e6a39ac7 0.1.1 wxbd7a3778ae99adb5 iOS 8.0.1 2.14.4
    <cloud-player 
      class="video"
      appid="{{appid}}"
      fileid="{{fileid}}"
      playurl="{{playurl}}"
      playerid="myVideo"
      class="video"
      width="750rpx"
      height="428rpx">

      <view 
        wx:if="{{coverShow}}"
        class="my_video_cover" 
        catchtap="handleTapPlay">
      </view>
    </cloud-player>

Component({
  properties: {
    fileidString,
    playurlString,
  },
  data: {
    appid: 'xxxxxxxxx',
    coverShowtrue//是否显示视频遮罩
  },
  observers: {
    'playurl'function(src{
      if(src) {
        // 在自定义组件开发中,需要多传入一个表示组件本身的参数this
        this.videoContext = wx.createVideoContext('myVideo'this)
      }
    }
  },
  methods: {
    // 点击播放
    handleTapPlay(){
      console.log(this.videoContext)
      this.setData({
        coverShowfalse
      })
      setTimeout(_ => {
        console.log('调用播放')
        this.videoContext.play()//无效
      }, 200)
    },
  }
})

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付