V3编译模式下,无法使用推流
小米安卓测试
V3模式下 推流报错,直接初始化都不行
nvue页面下的推流哈
16:33:54.458 TypeError: uni.createLivePusherContext is not a function. (In 'uni.createLivePusherContext("livePusher", that)', 'uni.createLivePusherContext' is undefined)
报错的代码
that.pusher = uni.createLivePusherContext("livePusher", that);
5 个回复
v***@qq.com (作者) - 蓝牙
没人吗?
v***@qq.com (作者) - 蓝牙
哎。。
1***@qq.com
解决办法:
修改manifest.json文件。
manifest.json -> "App常用其它设置" -> “编译模式” -> 去掉V3编译器
DCloud_uniAD_HDX
Bug已确认,下版修复,当前版本使用 ref 解决
v***@qq.com (作者)
ref 安卓无法使用啊。 直接黑屏。。 ios才可以使用。
2020-02-18 18:15
DCloud_uniAD_HDX
回复 v***@qq.com: 黑屏问题不是 ref 导致,贴下代码
2020-02-18 21:07
v***@qq.com (作者)
回复 DCloud_uniAD_HDX:
官方示例代码都不行。
<template>
<view>
<live-pusher id='livePusher1' 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: {
fil: true
},
onReady() {
// 注意:需要在onReady中 或 onLoad 延时
this.context = this.$refs.livepusher
console.log(this.context, 'this.context')
},
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() {
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() {
console.log('开启预览')
this.context.startPreview({
success: (a) => {
console.log("livePusher.startPreview:" + JSON.stringify(a));
},
fail:(e)=>{
console.log("livePusher.startPreview:" + JSON.stringify(e));
}
});
},
stopPreview: function() {
this.context.stopPreview({
success: (a) => {
console.log("livePusher.stopPreview:" + JSON.stringify(a));
}
});
}
}
}
</script>
<style>
page{
background-color: #000000;
}
.cback{
position: fixed;
left: 25rpx;
width:34rpx;
height: 58rpx;
padding:10rpx;
margin: 5rpx;
}
.content {
/ #ifndef APP-PLUS-NVUE /
display: flex;
/ #endif /
flex-direction: column;
/ #ifndef APP-PLUS-NVUE /
height: 100%;
/ #endif /
background-color: #000000;
}
.livePusher{
width: 750rpx;
/ #ifndef APP-PLUS-NVUE /
height: 100%;
/ #endif /
}
.butlist{
height: 140rpx;
position: fixed;
bottom: 0;
width: 750rpx;
padding-top: 20rpx;
/ border-top: 1px solid #fff; /
/ #ifndef APP-PLUS-NVUE /
display: flex;
/ #endif /
flex-direction: row;
justify-content: space-between;
}
.buticon{
height: 120rpx;
width: 120rpx;
color: #fff;
/ #ifndef APP-PLUS-NVUE /
display: flex;
/ #endif /
flex-direction: column;
text-align: center;
justify-content: center;
align-items:center;
}
</style>
2020-02-18 22:31
DCloud_uniAD_HDX
回复 v***@qq.com: 是真机运行?
2020-02-20 21:23
v***@qq.com (作者)
回复 DCloud_uniAD_HDX: 你好 是真机,安卓,小米8
2020-02-20 23:39
DCloud_uniAD_HDX
HBuilderX 2.6.0+ 已修复
迪丽热bug
怎么我升级到最新的hbx 然后粘贴官方案例 一堆报错...
2020-04-26 17:28
DCloud_uniAD_HDX
回复 迪丽热bug: 什么错误?
2020-04-26 20:36
9***@qq.com
回复 DCloud_uniAD_HDX: 这个好像又出问题了呢,前几天都是可以的,今天就不行了 ios可以 安卓部分手机可以 部分手机不行 e[t] is not a function这个错是什么错啊
2021-05-24 11:49