IM柳暗花明
IM柳暗花明
  • 发布:2021-12-07 23:35
  • 更新:2022-04-13 14:26
  • 阅读:688

【报Bug】nvue android机型LivePusher推流,一直回调statechange, 启动硬编,code 1008

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 11.2.3 (20D91)

HBuilderX类型: 正式

HBuilderX版本号: 3.2.16

手机系统: Android

手机系统版本号: Android 11

手机厂商: OPPO

手机机型: oppo reno 2

页面类型: nvue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: www.pgyer.com/X2p2

示例代码:
        <live-pusher  
        id='livePusher'  
        ref="livePusher"   
        class="livePusher"   
        :url="src"  
        :mode="mode"   
        :enable-camera="enableCamera"   
        :auto-focus="true"   
        :device-position="position"  
        :beauty="beauty"   
        :whiteness="whiteness"  
        aspect="9:16"   
        @statechange="statechange"   
        @netstatus="netstatus"   
        @error = "error"  
        :style="'height: '+windowHeight+'px;'"  
        style="width: 750rpx;"></live-pusher>

参数
{
"mode": "FHD",
"position": "back",
"beauty": 0,
"whiteness": 0
}
通过以上代码,onReady开始推流

        onReady() {  
            this.context = uni.createLivePusherContext('livePusher', this)  
            this.startPreview()  
            // 开始推流  
            this.start()  
        },  
// 开始推流  
            start(){  
                this.context.start({  
                    success:()=>{  
                        this.isStart = true  
                        $H.post('/changestatus',{  
                            id:this.detail.id,  
                            type:"play"  
                        },{  
                            userUuid:this.vuex_userInfo.userUuid,  
                            sessionid: this.vuex_userInfo.sessionid  
                        }).then(res=>{  
                            console.log('changestatus', res);  
                            this.joinOrLeaveLive('join')  
                        }).catch(err=>{  
                            console.log(err);  
                        })  
                    }  
                })  
            },

操作步骤:

登陆账号,选择直播tab,点击右上角开始创建直播,填写直播标题后,开始直播

预期结果:

android 推流正常,不会卡

实际结果:

android 推流界面卡顿,并且推流不成功,日志不断回调statechange,启动硬编, code 1008。
22:45:01.894 onLoad[data], [Object] {"data":{"created_time":"2021-12-07 22:45:01","cover":"","look_count":0,"coin":0,"status":0,"id":80,"title...} at pages/live/liveroom.nvue:225
22:45:01.958 startPreview, [Object] {"errMsg":"startPreview:ok"} at pages/live/liveroom.nvue:453
22:45:02.092 statechange, [Object] {"message":"已经连接rtmp服务器","code":1001} at pages/live/liveroom.nvue:459
22:45:02.533 changestatus, ok at pages/live/liveroom.nvue:319
22:45:02.556 joinOrLeaveLive, join at pages/live/liveroom.nvue:413
22:45:02.627 statechange, [Object] {"message":"打开摄像头成功","code":1003} at pages/live/liveroom.nvue:459
22:45:02.674 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:02.817 statechange, [Object] {"message":"rtmp开始推流","code":1002} at pages/live/liveroom.nvue:459
22:45:02.865 handleLiveEvent, [Object] {"type":"online","data":{"clients":["i5MQDoC9TZyIfyrPAAAc"],"action":"join","user":{"id":6,"name":"柳暗花明","...} at pages/live/liveroom.nvue:373
22:45:02.891 statechange, [Object] {"message":"首帧画面采集完成","code":1007} at pages/live/liveroom.nvue:459
22:45:02.915 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.078 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.218 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.334 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.464 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.595 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.728 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:03.868 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.002 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.027 netstatus, [Object] {"info":{"netJitter":0,"videoHeight":1280,"videoFPS":0,"videoWidth":720,"netSpeed":0,"videoGOP":0,"audioBi...} at pages/live/liveroom.nvue:463
22:45:04.111 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.229 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.367 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.508 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.628 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.745 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.878 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:04.992 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.110 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.227 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.372 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.459 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.577 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.691 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459
22:45:05.807 statechange, [Object] {"message":"启动硬编","code":1008} at pages/live/liveroom.nvue:459

bug描述:

nvue使用LivePusher开发推流功能,ios机型推流正常,而android机型开始推流后,经常界面卡顿,且推流不成功,无法在观看端拉流。日志不断回调statechange,启动硬编, code 1008。

2021-12-07 23:35 负责人:DCloud_Android_DQQ 分享
已邀请:
e***@outlook.com

e***@outlook.com

我这边也是ios没问题,安卓死活有问题
小米8会出现TCP连接错误
小米10推流没问题,但是拉出来的流数据是异常的,会卡在一帧上

现在打算不使用livepusher, 自己找人封装推流工具,比如七牛的推流SDK

  • codeAX

    加一

    2022-04-13 14:23

  • 彭先森

    请问各位大神解决了吗

    2023-07-13 10:24

codeAX

codeAX - 拥抱开源

我这边遇到了几乎一样的问题,可能是重复调用了太多次 startPreview

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