落英甘棠
落英甘棠
  • 发布:2025-08-12 11:35
  • 更新:2025-08-12 11:35
  • 阅读:46

【报Bug】targetSdkVersion值设置为30,live-pusher推流无声音

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 4.75

手机系统: Android

手机系统版本号: Android 15

手机厂商: 小米

手机机型: 小米15

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template> <view> <live-pusher id='livePusher' ref="livePusher" class="livePusher" url="rtmp://gwm-000-cn-0604.bcloud365.net:9016/talk_5a9a0b11b208efd90/M3w1YTlhMGIxMWIyMDhlZmQ5fGIzYmRkNDk0YjBlNDJkMjBjNWY4OGZiZWI0NWYwZTJjMTA4Mz4RhODgwZGFiMGM0YjVlNTc2Mzc0ZDRhMjYzNjF8cnRtcHwxNzU0NjI1Mzg2fDE3NTY0MTYwMTE%3D.54330d11b5a3bfba6497a7fcf40c5863" 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>

操作步骤:

开始推流

预期结果:

接收方正常收到推流内容

实际结果:

推流没有声音

bug描述:

使用uniapp组件live-pusher推流,manifest.json文件的targetSdkVersion值不设置,打包后可以正常接收到推流内容。

targetSdkVersion设置为30,打包后接收不到推流声音(目前只做音频推流,所以视频是否异常未知)

2025-08-12 11:35 负责人:DCloud_App_Array 分享
已邀请:

要回复问题请先登录注册