小程序
小游戏
企业微信
微信支付
扫描小程序码分享
微信小游戏在android设备上运行概率性出现视频播放失败,返回的错误码是解码失败MEDIA_ERR_DECODE。
麻烦帮忙看看,印象中ios没有出现过这样的问题
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
能提供复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)吗?官方的小游戏API调用示例(https://github.com/wechat-miniprogram/minigame-demo)复现不了你的bug
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
能提供复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)吗?官方的小游戏API调用示例(https://github.com/wechat-miniprogram/minigame-demo)复现不了你的bug
var video
let { screenWidth, screenHeight } = wx.getSystemInfoSync()
var myvideos = new Array()
myvideos[0] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u2l1/video/car/ufo/ufo.mp4"
myvideos[1] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u2l1/video/plane/ufo/ufo.mp4"
myvideos[2] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u2l1/video/bus/ufo/ufo.mp4"
myvideos[3] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u3l1/video/apple/ufo/ufo.mp4"
myvideos[4] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u3l1/video/orange/ufo/ufo.mp4"
myvideos[5] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u3l1/video/pear/ufo/ufo.mp4"
myvideos[6] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u2l1/video/car/ufo/hello.mp4"
myvideos[7] = "https://tomabc.oss-cn-hangzhou.aliyuncs.com/2DResources/u3l1/video/apple/ufo/hello.mp4"
var i = 0
export default class Main {
constructor() {
wx.setEnableDebug({
enableDebug: true
})
this.play()
}
play () {
this.stop()
video = wx.createVideo({
x: (screenWidth - screenHeight * 4 / 3) / 2,
y: 0,
width: screenHeight * 4 / 3,
height: screenHeight,
src: myvideos[i%myvideos.length],
underGameView: true,
autoplay: true,
controls: false,
objectFit: 'cover',
enableProgressGesture: false,
showCenterPlayBtn: false,
customcache:false,
})
var start = true
var pause = true
video.onTimeUpdate((res) => {
console.error('start, cur time:' + res.position + ", total time" + res.duration)
if (pause && (res.duration - res.position) < 0.2 && res.duration > 0 && res.position > 0) {
console.error('pause, cur time:' + res.position + ", total time" + res.duration)
pause = false
video.pause()
i++
console.error(i+" "+myvideos[i%myvideos.length])
this.play()
}
})
video.onError((res) => {
console.error('视频加载失败,请检查网络' + res.errMsg);
wx.showModal({
content: '视频加载失败,请检查网络',
confirmText: '重试',
showCancel: false,
success: function (res) {
console.error('视频加载失败,请检查网络,重试')
}
});
})
}
stop() {
if (video) {
video.stop()
}
}
}