aaadddd
aaadddd
  • 发布:2020-10-13 11:42
  • 更新:2020-11-13 15:53
  • 阅读:1633

最新版HbuiderX uni.createLivePusherContext can not find 'livePusher'

分类:uni-app

1、HbuiderX 已更新到最新版 2.8.13
2、页面为 nvue文件
3、使用live-pusher组件

<live-pusher :style="[pushStyle]" id="livePusher" ref="livePusher" :orientation="orientation"  
            :beauty="beauty" :whiteness="whiteness" :muted="muted" :enable-camera="enableCamera" :mode="mode"  
            :background-mute="backgroundMute"  
            :url=""  
            @statechange="onPushEvent" @netstatus="onNetStatus" @error="error">  
        </live-pusher>

4、onReady 中 createLivePusherContext 创建 livePusher 对象

onReady() {  
            // 初始化推流组件  
            this.cameraContext = uni.createLivePusherContext("livePusher", this);  
            console.log(this.cameraContext)  
        },

5、运行在手机模拟器上会报错 can not find 'livePusher'

2020-10-13 11:42 负责人:无 分享
已邀请:
o***@126.com

o***@126.com

你在create里创建不行的话就包个setTimeout

DCloud_uniAD_HDX

DCloud_uniAD_HDX

请提供这个页面的完整代码

  • aaadddd (作者)

    谢谢,问题已解决,是自己的其他代码流程上有问题

    2020-10-27 16:43

  • 1***@163.com

    回复 aaadddd:你好,我也遇到这个问题了,请问你是怎么解决的

    2021-05-18 16:43

apple_20000

apple_20000

运行在手机模拟器上会报错 can not find 'livePusher'怎么解决的

3***@qq.com

3***@qq.com

你好,我也遇到了这个问题,请问你是怎么解决的,是时序的问题吗?还是别的

  • aaadddd (作者)

    你看看你的代码里面有没有哪儿请求时间问题。我的是一个控制页面显示的参数,在请求之后才获取,而创建livePusher的代码去获取livePusher的时候,页面上还没有渲染出 <live-pusher>

    2020-11-26 10:52

  • 3***@qq.com

    回复 aaadddd: 应该是时序问题,好像在app里一定要在onReady中,调用这个创建livePusher

    2020-12-08 09:13

该问题目前已经被锁定, 无法添加新回复