更新记录
1.0.0(2025-06-27)
1.0.0版本 支持阿里云直播推流 支持镱像、预览、禁音、摄像头翻转、显示大小可控制
平台兼容性
uni-app(4.51)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | - | 13 | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x(4.51)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | - | 13 | - | - |
直播 方法
1: init 参数 @{"resolution": , "cameraType"}
typedef NS_ENUM(NSInteger, AlivcLivePushResolution){ AlivcLivePushResolution180P = 0, AlivcLivePushResolution240P, AlivcLivePushResolution360P, AlivcLivePushResolution480P, AlivcLivePushResolution540P, AlivcLivePushResolution720P, AlivcLivePushResolution1080P, 推流分辨率,默认为 AlivcLivePushResolution1080P
cameraType:摄像头类型,默认为前置摄像头 typedef NS_ENUM(NSInteger, AlivcLivePushCameraType){ AlivcLivePushCameraTypeBack = 0, AlivcLivePushCameraTypeFront, };
2: startPreview 参数 @{"rect": {}} rect:字典类型,定义预览区域的 x、y、w、h
3: startPush 参数: @{"url":} url:推流 URL。
4: switchCamera 切换摄像头 参数: @{}
5: mute 静音 参数: @{"mute"} mute:布尔值,YES 表示静音,NO 表示取消静音。
6: 设置镜像 mirror 参数 : @{"mirror":} mirror:布尔值,YES 表示开启镜像,NO 表示关闭镜像。
7: 暂停推流 pause 参数: @{}
8: resume 恢复推流 参数: @{}
9: stopPush 停止推流 参数: @{}
10: stopPreview 停止预览 参数: @{}
11: destory 销毁推流实例 参数: @{}
12: setLivePlayerListener 设置推流状态监听 回调: @{"code:"xxxx}, 如果是error,会额外返回 msg 字段 xxxxx StatusErrorNone = 9, SystemError = 10, SDKError, ConnectFail, SendDataTimeout, SendSeiMessage, ConnectRecovery, ConnectionStatus, NetworkPoor, // 当前网速较慢,请检查网络状态 ReconnectStart, ReconnectSuccess, ReconnectError, PushURLAuthenticationOverdue, // 推流url 过期 PreviewStarted, PreviewStoped, PushStarted, PushPaused, PushResumed, PushStoped, FirstFramePreviewed, PushRestart,
13:removeLivePlayerListener 移除推流状态监听
建议联插件作者如何接入使用。