今天更新到最新的开发者工具后,video组件无法播放视频一直在转圈,这个为什么?求大佬解答。
发布于 3 年前 作者 iding 6645 次浏览 来自 官方Issues

这是wxml

      <view class="section tc">

  <video id="myVideostyle="height:{{videoHeight}}px;width:{{videoWidth}}pxcontrols="falseautoplay="truesrc="voice/5.mp4binderror="videoErrorCallbackdanmu-list="{{danmuList}}controls>

  </video>

</view>

这是js

onLoad: function(options) {

    var _this = this;

    //获取屏幕宽高  

    _this.setData({

      userInfo: app.globalData.user

    })

    wx.getSystemInfo({

      success: function(res) {

        var windowWidth = res.windowWidth;

        //video标签认宽度300px、高度225px,设置宽高需要通过wxss设置width和height。

        var videoHeight = (225 / 300* windowWidth //屏幕高宽比  

        console.log('videoWidth: ' + windowWidth)

        console.log('videoHeight: ' + videoHeight)

        _this.setData({

          videoWidth: windowWidth,

          videoHeight: videoHeight

        })

      }

    })


  


      var that = this;

        wx.request({

            url: "http://localhost:8080/Examination_System_war_exploded/wxadmin/wxshowTeacher",

            //     data: { 'page': pagenum },

            method: "POST",

            header: {

                'content-type': 'application/x-www-form-urlencoded'

            },

            success: function (res) {

        _this.setData({

          video: res.data.teacherlist

        })

        console.log(res.data)

        // video[123].USERNAME

      },

      fail: function(res) {

        console.log(".....fail.....");

      }

    })

  },


 


//点击视频

onclick:function(event){

  this.setData({

    arr: event.currentTarget.id

  })

  this.videoContext.play()

},



bindInputBlur: function(e) {

  this.inputValue = e.detail.value

},

bindSendDanmu: function() {

  if (this.data.isRandomColor{

    var color = getRandomColor();

  } else {

    var color = this.data.numberColor;

  }


  this.videoContext.sendDanmu({

    

    text: this.inputValue,

    color: color

  })

},

videoErrorCallback: function(e) {

  console.log('视频错误信息:')

  console.log(e.detail.errMsg)

},

1 回复

你好,真机正常吗?

回到顶部