yyh_developer
yyh_developer
  • 发布:2021-08-31 10:55
  • 更新:2022-09-27 15:25
  • 阅读:1154

【报Bug】安卓华为直播流控件预览快照2次后闪退

分类:HTML5+

产品分类: HTML5+

HBuilderX版本号: 3.2.3

手机系统: Android

手机系统版本号: Android 10

手机厂商: 华为

手机机型: nova5i Mate10

打包方式: 云端

示例代码:

<template>
<div class="real_time_extract_img">
<x-header :left-options="{backText: '', preventGoBack: true}" @on-click-back="onBack">测试</x-header>
<div class="player" id="playerRef"></div>
<button @click="snapshot">快照</button>
</div>
</template>

<script>
import { XHeader } from 'vux';
export default {
components: {XHeader},
data() {
return {
pusher: null
};
},
mounted() {
this.init();
},
methods: {
init() {
if (!window.plus) return;
document.addEventListener('plusready', this.initPusher(), false);
},
initPusher() {
this.pusher = new window.plus.video.LivePusher('playerRef', {
mode: 'HD',
position: 'static',
top: '47px',
with: '100%',
height: '300px',
bottom: '46px',
muted: true
});
window.plus.webview.currentWebview().append(this.pusher);
this.preview();
// 监听状态变化事件
this.pusher.addEventListener('statechange', function(e) {
console.log('statechange: ' + JSON.stringify(e));
}, false);
// 监听网络状态变化事件
this.pusher.addEventListener('netstatus', function(e) {
console.log('netstatus: ' + JSON.stringify(e));
}, false);
// 监听错误事件
this.pusher.addEventListener('error', function(e) {
console.log('error: ' + JSON.stringify(e));
}, false);
},
preview() {
this.pusher && this.pusher.preview();
},
snapshot() { // 快照
this.pusher && this.pusher.snapshot((e) => {
window.plus.nativeUI.alert('snapshot success: ' + JSON.stringify(e));
}, (e) => {
window.plus.nativeUI.alert('snapshot error: ' + JSON.stringify(e));
});
},
close() {
this.pusher && this.pusher.close();
},
onBack() {
this.$router.back();
this.close();
}
}
};
</script>

<style lang="scss" scoped>
.real_time_extract_img{
box-sizing: border-box;
width: 100vw;
height: 100vh;
overflow: hidden;
padding-top: 47px;
.player{
height: 300px;
}
}
</style>

操作步骤:

创建了一个直播流控件,然后预览,点击按钮获取快照,第一次成功了,然后点击第二次获取快照,然后应用就闪退了

预期结果:

每一次点击获取快照都能成功获取

实际结果:

第二次获取快照,应用闪退

bug描述:

snapshot() { // 快照
this.pusher && this.pusher.snapshot((e) => {
window.plus.nativeUI.alert('snapshot success: ' + JSON.stringify(e));
}, (e) => {
window.plus.nativeUI.alert('snapshot error: ' + JSON.stringify(e));
});
},
安卓调用第一次成功后,第二次应用直接闪退

2021-08-31 10:55 负责人:DCloud_Android_DQQ 分享
已邀请:

最佳回复

DCloud_Android_DQQ

DCloud_Android_DQQ

根据新发的ask地址:https://ask.dcloud.net.cn/question/147593

提供的示例,我复现了闪退的问题,并做了相关处理。

其他问题我无法复现,更具体的回复查看新的ask

5***@qq.com

5***@qq.com

解决了吗?我现在也出现这个问题

5***@qq.com

5***@qq.com

我还发现一个问题就是快照拍出来的图片方向不对

5***@qq.com

5***@qq.com

我的解决方法是createLivePusher重置

  • 5***@qq.com

    我现在是预览图片返回时会闪退,而且快照的清晰度不行

    2021-09-14 17:59

d***@163.com

d***@163.com - web前端

解决了吗,我也出现了这个问题

phoeniix

phoeniix - Hello World

一年了,问题还有,,,,,,

要回复问题请先登录注册