uniapp小程序 推流断流
2021/10/28 20:39:41
本文主要是介绍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和2会黑屏一下再推流,3画面不变直接推流
通过live-player断流只能报网络断连,不知道为什么 - 断流也没有黑屏效果,只能画面停住。黑屏效果可以cover-view写
- 推流断流的按钮@click一定要写在button上不能写在cover-view上;
但是cover-image实现点击效果,@click要写在外面包的cover-view上 - 每次推流断流都要重新创建uni.createLivePlayerContext
- 如果初始化进入页面就要显示视频,uni.createLivePlayerContext写在onReady里
这篇关于uniapp小程序 推流断流的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-13微信小程序如何封装接口域名?-icode9专业技术文章分享
- 2024-11-13如何在微信小程序中实现直传功能?-icode9专业技术文章分享
- 2024-11-13如何在小程序的地图组件中添加标记和文字?-icode9专业技术文章分享
- 2024-11-13在微信小程序的地图组件中如何实现自定义标记和气泡?-icode9专业技术文章分享
- 2024-11-01微信小程序教程:零基础入门到实战
- 2024-11-01微信小程序全栈教程:从入门到实践
- 2024-10-31微信小程序怎么实现关注公众号功能-icode9专业技术文章分享
- 2024-10-30微信小程序cover-view,支持bindtap吗-icode9专业技术文章分享
- 2024-10-30微信小程序的cover-image支持bindtap吗-icode9专业技术文章分享
- 2024-10-30微信小程序web-view怎么设置高度?-icode9专业技术文章分享