uni-app live-pusher 组件直播推流报错 本地调试可以推流 发布后报错不能推流

uni-app live-pusher 组件直播推流报错 本地调试可以推流 发布后报错不能推流

开发环境 版本号 项目创建方式
Mac 11.3.1 (20E241) HBuilderX

产品分类:uniapp/App

PC开发环境操作系统:Mac

HBuilderX类型:正式

HBuilderX版本号:3.1.12

手机系统:Android

手机系统版本号:Android 9.0

手机厂商:华为

手机机型:mate 20

页面类型:nvue

打包方式:云端

示例代码:

报错内容: [JS Framework] Failed to execute the callback function: TypeError: e[t] is not a function reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: e[t] is not a function

app调用: this.context = uni.createLivePusherContext(“livePusher”, this)

setTimeout(() => { this.context.start({ success: (a) => { console.log(“livePusher.start:” + JSON.stringify(a)) } }) }, 1000)


操作步骤:


报错内容:
[JS Framework] Failed to execute the callback function:
TypeError: e[t] is not a function
reportJSException >>>> exception function:**WEEX_CALL_JAVASCRIPT**, exception:JavaScript execute error!Uncaught TypeError: e[t] is not a function  

app调用:
this.context = uni.createLivePusherContext("livePusher", this)  

setTimeout(() => {
this.context.start({
success: (a) => {
console.log("livePusher.start:" + JSON.stringify(a))
}
})
}, 1000)

预期结果:

不报错,可直接实现推流直播


实际结果:


报错报错报错!!!

报错内容:
[JS Framework] Failed to execute the callback function:
TypeError: e[t] is not a function
reportJSException >>>> exception function:**WEEX_CALL_JAVASCRIPT**, exception:JavaScript execute error!Uncaught TypeError: e[t] is not a function  

更多关于uni-app live-pusher 组件直播推流报错 本地调试可以推流 发布后报错不能推流的实战教程也可以访问 https://www.itying.com/category-93-b0.html

5 回复

问题已解决:打包时缺少权限
https://uniapp.dcloud.net.cn/component/live-pusher
App平台:使用 <live-pusher/> 组件,打包 App 时必须勾选 manifest.json->App 模块权限配置->LivePusher(直播推流) 模块。

更多关于uni-app live-pusher 组件直播推流报错 本地调试可以推流 发布后报错不能推流的实战教程也可以访问 https://www.itying.com/category-93-b0.html


有遇到自定义基座打不上的情况么

我也是报这个错误的

回复 onion一只洋葱: 同问

这是一个典型的本地调试正常但打包后出现异常的案例。从错误信息看,问题出在 createLivePusherContext 获取的上下文对象上,打包后 start 方法可能未正确绑定。

解决方案:

  1. 检查组件渲染时机
    确保在 live-pusher 组件完全渲染后再获取上下文。将 createLivePusherContext 放在 onReady 生命周期中:

    onReady() {
      this.context = uni.createLivePusherContext("livePusher", this)
    }
    
  2. 添加容错处理
    在调用 start 前验证上下文和方法是否存在:

    setTimeout(() => {
      if (this.context && typeof this.context.start === 'function') {
        this.context.start({
          success: (a) => {
            console.log("livePusher.start:" + JSON.stringify(a))
          }
        })
      } else {
        console.error('LivePusher context or start method not available')
      }
    }, 1000)
回到顶部