信赖的阿涛
信赖的阿涛
  • 发布:2022-12-29 17:20
  • 更新:2024-01-26 11:28
  • 阅读:652

live-pusher组件在app端安卓使用,确认两次权限后,可以获取画面,退出app,再打开之后会黑屏没有画面,error报错是渲染错误。

分类:uni-app

live-pusher组件在app端安卓使用,确认两次权限后,可以获取画面,退出app,再打开之后会黑屏没有画面,error报错是渲染错误。app端vue项目使用nvue页面。华为nova5pro,鸿蒙系统。

2022-12-29 17:20 负责人:DCloud_Android_ST 分享
已邀请:

最佳回复

DCloud_Android_YJC

DCloud_Android_YJC

HBuilderX 3.6.16-alpha 已修复

DCloud_Android_ST

DCloud_Android_ST

请提供具体示例demo

信赖的阿涛

信赖的阿涛 (作者)

vue项目中的nvue页面

<template>
<view>
<live-pusher id='livePusher' ref="livePusher" class="livePusher" url=""
mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2"
aspect="9:16" @statechange="statechange" @netstatus="netstatus" @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));
},
netstatus(e) {
console.log("netstatus:" + 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() {
console.log('--');
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>

信赖的阿涛

信赖的阿涛 (作者)

<template>
<view>
<live-pusher id='livePusher' ref="livePusher" class="livePusher" url=""
mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2"
aspect="9:16" @statechange="statechange" @netstatus="netstatus" @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>

信赖的阿涛

信赖的阿涛 (作者)

demo

  • DCloud_Android_YJC

    能具体描述一下demo的复现步骤么?使用的HX版本是多少?

    2023-01-04 16:16

  • 信赖的阿涛 (作者)

    回复 DCloud_Android_YJC: 版本是3.6.14 alpha,复现场景是:首次打开页面,获取权限相机和麦克风,确认后,出现摄像头预览画面,后执行程序逻辑正常,这时候发现,如果退出app(后台删除进度),再次打开页面,摄像头预览界面是黑屏的(现测试华为鸿蒙系统发现此问题,ios可以使用)。可以加我qq,1422253137,有操作视频。

    2023-01-05 09:04

  • 信赖的阿涛 (作者)

    回复 信赖的阿涛: 此页面为vue项目中使用的nvue页面。

    2023-01-05 09:38

m***@163.com

m***@163.com

作者您好, 请问你最后解决这个问题了嘛? 我也遇到同样的问题,切换到后台再打开就是黑屏

  • 信赖的阿涛 (作者)

    解决了,更新下hbuilderx,然后重新打自定义基座包。

    2024-03-18 10:27

要回复问题请先登录注册