收藏
回答

鸿蒙系统LivePusherContext.snapshot拿不到截图路径?

系统信息:华为nova12pro

{"model":"ADA-AL00","deviceAbi":"arm64-v8a","benchmarkLevel":-1,"abi":"arm64-v8a","windowHeight":733,"statusBarHeight":43,"screenTop":89,"microphoneAuthorized":true,"screenWidth":362,"screenHeight":822,"deviceOrientation":"portrait","version":"8.0.6","system":"HarmonyOS 5.0.0","cameraAuthorized":true,"windowWidth":362,"fontSizeSetting":16,"bluetoothAuthorized":false,"theme":"light","cpuType":"TWEM","memorySize":0,"phoneCalendarAuthorized":false,"safeArea":{"top":43,"left":0,"width":362,"height":750,"right":362,"bottom":794},"locationAuthorized":false,"fontSizeScaleFactor":1,"pixelRatio":3.375,"notificationAuthorized":true,"locationEnabled":false,"wifiEnabled":true,"errno":0,"locationReducedAccuracy":false,"language":"zh_CN","brand":"HUAWEI","bluetoothEnabled":false,"platform":"ohos","SDKVersion":"3.8.5","enableDebug":true,"devicePixelRatio":3.375,"host":{"env":"WeChat","version":4077913637},"mode":"default"}

说明:

没有进房间,没有推流,调用预览api后本地可以看到视频,再截图,截图走到success回调,但是没有返回截图的临时路径

代码片段:

const wx_pusher = wx.createLivePusherContext("wx_pusher")

// 先调用预览,本地可以看到视频
wx_pusher.startPreview({
    success: function () {
      resolve()
    },
    fail: function (err) {
      reject(err);
    }
})

// 预览成功后,截图
wx_pusher.snapshot({
  quality: 'compressed',
  sourceType: 'view',
  complete:(e)=>{
    if (e.tempImagePath) {
      resolve(e) 
      // 鸿蒙系统返回 {"errno":0,"errMsg":"operateXWebLivePusher:ok"}
      // 正常手机返回 {"errno":0,"tempImagePath":"","width":xx,"height":xx}
    } else {
      reject(e)
    }
 }
})


最后一次编辑于  05-16
回答关注问题邀请回答
收藏

1 个回答

  • 过期罐头
    过期罐头
    05-16

    微信上传了日志,微信号w1740086582,日志时间段:2025/5/16 0:00~24:00,报错问题时间点大约在:2025-05-16 18:17

    05-16
    有用
    回复
登录 后发表内容