videojs无法自动播放的问题

在设置box的宽高之后,videojs不能自动播放,各位有办法么?

<style>
  .box {
    width: 270px;
    height: 480px;
    overflow: hidden;
  }
  #my-video {
    width: 100%;
    height: 100%;
  }
</style>

<div class="box">
  <video id="my-video" autoplay="autoplay">
    <source src="rtmp...xxx" type="rtmp/flv" class="src">
  </video>
</div>

<script>
  var player = videojs('my-video', {
    autoplay: true
  }, function onPlayerReady() {
    this.play()
  })
</script>
阅读 13.8k
1 个回答

其他代码,我没发现问题,但是你确定video元素标签支持type="rtmp/flv" ,这种视频流。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题