uniapp小程序 推流断流

推流:
this.livePlayer = uni.createLivePlayerContext(“video-livePlay”);
this.url = url;
this.livePlayer.play();

断流1:
this.livePlayer.stop();
this.url = “rtmp://xxxxxxxxxxxxxxx”;
this.livePlayer = uni.createLivePlayerContext(“video-livePlay”);

断流之后的状态码:
2008 Enable default H264 hardware decoder. ->
2103 Enables network reconnection. ->
…三次2103后
-2301 Failed to reconnect many times. Abandon the connection.

断流2
this.livePlayer.stop();
this.url = “”;
this.livePlayer = uni.createLivePlayerContext(“video-livePlay”);

断流之后的状态码:
2008 Enable default H264 hardware decoder. ->
2001 Connected to server. ->
[3005 tcp channel recv fail, errCode[-3] . ->
2103 Enables network reconnection. ->
2001 Connected to server.] ->
…三次[ ]后
3005 tcp channel recv fail, errCode[-3] . ->
-2301 Failed to reconnect many times. Abandon the connection.

断流3
this.livePlayer.stop();
this.url = “”;
this.livePlayer = null;

断流之后的状态码:
2008 Enable default H264 hardware decoder. ->
2001 Connected to server. ->
[3005 tcp channel recv fail, errCode[-3] . ->
2103 Enables network reconnection. ->
2001 Connected to server.] ->
…三次[ ]后
3005 tcp channel recv fail, errCode[-3] . ->
-2301 Failed to reconnect many times. Abandon the connection.

  1. 1和2会黑屏一下再推流,3画面不变直接推流
    通过live-player断流只能报网络断连,不知道为什么
  2. 断流也没有黑屏效果,只能画面停住。黑屏效果可以cover-view写
  3. 推流断流的按钮@click一定要写在button上不能写在cover-view上;
    但是cover-image实现点击效果,@click要写在外面包的cover-view上
  4. 每次推流断流都要重新创建uni.createLivePlayerContext
  5. 如果初始化进入页面就要显示视频,uni.createLivePlayerContext写在onReady里
上一篇:uni-app微信公众号——网页授权登录(1)


下一篇:Sequence Model - Sequence Models & Attention Mechanism