微信小游戏android视频播放失败

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:01 947 0 全屏看文

AI助手支持GPT4.0

微信小游戏android视频播放失败

微信小游戏在android设备上运行概率性出现视频播放失败,返回的错误码是解码失败MEDIA_ERR_DECODE。

麻烦帮忙看看,印象中ios没有出现过这样的问题

When wechat games run on Android devices, there is a probability that video playback fails, and the error code returned is media, which fails to decode_ ERR_ DECODE。 Please help to have a look. I don't think IOS has had such a problem

回答:

Forever:

能提供复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)吗?官方的小游戏API调用示例(https://github.com/wechat-miniprogram/minigame-demo)复现不了你的bug

黄炜良:你好 我这边观察,如果只播放同一个视频一直循环播放是没有问题的,但是如果播放不同的视频,播着播着就卡主了。但是这个没有提示任何的错误信息。
Forever:那能不能制作简单的代码片段呢?
黄炜良:也是不行的,同一个视频循环播放16次之后也出现解码失败
黄炜良:这是我这边的代码
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()
    }
  }
}
黄炜良:每次播放完毕之后再播放另外一个视频
Forever:你上面的这段代码只是视频缓冲好就继续缓冲下一个视频吧
Forever:而且能否配合一下?能提供复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)会很难吗?
黄炜良:不是,那个是自动播放的。我看看可不可以,没试过出代码片段
黄炜良:您好,这是我的代码片段,麻烦帮忙看看https://developers.weixin.qq.com/s/tiss3xmb7Gi5  谢谢您
黄炜良:IOS也会出现,但是ios是循环播放很多遍了才出现
黄炜良:你好,麻烦问一下,现在是什么情况了
Forever:我们相关人员正在排查
黄炜良:谢谢,麻烦了
Forever:能麻烦你那边复现一次吗?然后在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点
黄炜良:好的
黄炜良:你好,已上传日志10:51
Forever:微信号呢?
黄炜良:J1234567887654321
黄炜良:你好,这个问题能查到什么原因了吗
黄炜良:你好,麻烦问一下,那个问题现在跟进得怎么样,能先给一个结论吗?

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
为什么没有摇杆事件?改变了人物方向
map地图的主题颜色怎么修改,默认的地图上元素都是亮色的,怎么改成灰色的?
图片不能直接拉到文章里吗?都要上传一下,麻烦
创建卡券有效期的结束日期按照文档填写当天的23:59:59,但是显示出来却增加了一天?
微信分享小程序,打开微信,微信卡死?
随便看看
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8428
问题? 7643
如何快速搭建抽奖助手小程序(无需代码知识) 5211
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6482
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5782
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5444
如何解决渲染层网络错误Failed to load media? 16690
小程序找号找回 释放昵称? 2724
我的小程序广告主收入5301,实际进账4406,是怎么回事呀? 2597
删除部分微信用户个人数据的通知,怎么删除? 5660