问题模块 | 框架类型 | API/组件名称 | 终端类型 | 操作系统 | 微信版本 | 基础库版本 |
---|---|---|---|---|---|---|
API和组件 | 小程序 | wx.createVideoContext | 客户端 | iOS | weChat 6.6.1 | ios11.02 |
根据网络状态的切换,想要在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(); } } }) |