落英甘棠
落英甘棠
  • 发布:2025-08-19 09:05
  • 更新:2025-08-19 09:05
  • 阅读:20

【报Bug】targetSdkVersion值设置30+打包后live-pusher组件推流异常

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win11

HBuilderX类型: 正式

HBuilderX版本号: 4.75

手机系统: Android

手机系统版本号: Android 15

手机厂商: 小米

手机机型: 小米15

页面类型: nvue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template> <view> <live-pusher id='livePusher' ref="livePusher" class="livePusher" url="rtmp://gwm-000-cn-0349.bcloud365.net:9016/talk_5a9a0b11b208efd90/M3w1YTlhMGIxMWIyMDhlZmQ5fDUxZDI2M2MwZmUxZTYzOWRlYmQ4M2QyYzNhNDY1Yjk3NDBiNW7QzNTVlMGRjYTBlYjBiYmZlMzQ2NTc5NDI0ZDR8cnRtcHwxNzU1MDQ3NzU1fDE3NTY4Mzg4MDI%3D.8ead46d54850e1ccf3dd328c635bbc3f" enable-camera="false" @statechange="statechange" @error="error"></live-pusher> <button class="btn" @click="start">开始推流</button>
<button class="btn" @click="pause">暂停推流</button>
<button class="btn" @click="resume">resume</button>
<button class="btn" @click="stop">停止推流</button>
<button class="btn" @click="snapshot">快照</button>
<button class="btn" @click="startPreview">开启摄像头预览</button>
<button class="btn" @click="stopPreview">关闭摄像头预览</button>
<button class="btn" @click="switchCamera">切换摄像头</button>
</view>
</template>

<script>
export default {
data() {
return {}
},
onReady() {
// 注意:需要在onReady中 或 onLoad 延时
this.context = uni.createLivePusherContext("livePusher", this);
},
methods: {
statechange(e) {
console.log("statechange:" + JSON.stringify(e));
},
error(e) {
console.log("error:" + JSON.stringify(e));
},
start: function() {
this.context.start({
success: (a) => {
console.log("livePusher.start:" + JSON.stringify(a));
}
});
},
close: function() {
this.context.close({
success: (a) => {
console.log("livePusher.close:" + JSON.stringify(a));
}
});
},
snapshot: function() {
this.context.snapshot({
success: (e) => {
console.log(JSON.stringify(e));
}
});
},
resume: function() {
this.context.resume({
success: (a) => {
console.log("livePusher.resume:" + JSON.stringify(a));
}
});
},
pause: function() {
this.context.pause({
success: (a) => {
console.log("livePusher.pause:" + JSON.stringify(a));
}
});
},
stop: function() {
this.context.stop({
success: (a) => {
console.log(JSON.stringify(a));
}
});
},
switchCamera: function() {
this.context.switchCamera({
success: (a) => {
console.log("livePusher.switchCamera:" + JSON.stringify(a));
}
});
},
startPreview: function() {
this.context.startPreview({
success: (a) => {
console.log("livePusher.startPreview:" + JSON.stringify(a));
}
});
},
stopPreview: function() {
this.context.stopPreview({
success: (a) => {
console.log("livePusher.stopPreview:" + JSON.stringify(a));
}
});
}
}
}
</script>

<style>
.livePusher {
width: 0;
height: 0;
}
</style>

操作步骤:

1、复制代码
2、manifest.json配置的targetSdkVersion值设置为30/31
3、制作自定义调试基座

预期结果:

成功推流

实际结果:

推流异常

bug描述:

配置参数targetSdkVersion值设置为30,live-pusher组件推流无声音。targetSdkVersion值设置为31,live-pusher组件启动就闪退。

代码使用的是live-pusher组件示例代码:组件示例代码

2025-08-19 09:05 负责人:无 分享
已邀请:

要回复问题请先登录注册