videoContext.play()间歇性播放不了?
根据网络状态的切换,想要在wifi状态自动播放视频,非wifi下暂停播放。在开发者工具上效果没有问题。但是手机上测试,间歇性出现play()没有生效。
以下是我的代码,不知道是否我的处理方式存在问题
Page({ data: { }, onLoad: function(options){ let that =this that.getclassList(); // 网络切换的判断 wx.onNetworkStatusChange(function(res) { var res = res.networkType that.getNetwork(res) }) }, getNetwork:function(res){ let that = this that.videoContext = wx.createVideoContext('myVideo'); if(res =='wifi'){ that.videoContext.play() }else{ that.videoContext.pause(); } }}) |
