v***@qq.com
v***@qq.com
  • 发布:2020-02-08 17:50
  • 更新:2020-02-24 15:58
  • 阅读:1049

【报Bug】V3编译模式下,nvue页面无法使用推流

分类:uni-app

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);
2020-02-08 17:50 负责人:无 分享
已邀请:
v***@qq.com

v***@qq.com (作者) - 蓝牙

没人吗?

v***@qq.com

v***@qq.com (作者) - 蓝牙

哎。。

1***@qq.com

1***@qq.com

解决办法:
修改manifest.json文件。
manifest.json -> "App常用其它设置" -> “编译模式” -> 去掉V3编译器

DCloud_uniAD_HDX

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;


    }  
    .buticon-image{
    height:40rpx;
    width: 40rpx;
    }
    .mar10{
    text-align: center;
    font-size: 28rpx;
    color: #FFFFFF;
    }
    .give {
    width: 90rpx;
    height: 90rpx;
    background-color: #3982F5;
    border-radius: 45rpx;
    box-shadow: 0 0 22rpx 0 rgb(252, 94, 20);
    position: absolute;
    left:15rpx;
    top:15rpx;
    font-size: 28rpx;
    line-height: 90rpx;
    justify-content: center;
    text-align: center;
    color: #FFFFFF;
    }
    .givebegin {
    width: 60rpx;
    height: 60rpx;
    background-color: #F44336;
    border-radius: 12rpx;
    /* box-shadow: 0 0 22rpx 0 rgb(252, 94, 20); */
    position: absolute;
    left:30rpx;
    top:30rpx;
    font-size: 28rpx;
    line-height: 60rpx;
    justify-content: center;
    text-align: center;
    color: #FFFFFF;
    }
    .x_f{
    /* border: 6rpx solid #F44336; */
    width: 120rpx;
    height: 120rpx;
    background-color: #fff;
    border-radius: 60rpx;
    position: absolute;
    text-align: center;
    top:0;
    left: 0;
    box-shadow: 0 0 28rpx 0 rgb(251, 99, 24);
    }

    /* 产生动画(向外扩散变大)的圆圈 */
    .pulse {
    /* width: 160rpx;
    height: 160rpx;
    position: absolute;
    border: 12rpx solid #F44336;
    border-radius: 750rpx;
    z-index: 1;
    opacity: 0;
    -webkit-animation: warn 2s ease-out;
    animation: warn 2s ease-out;
    -webkit-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
    left: -28rpx;
    top: -28rpx; */
    }

    /**
    * 动画
    */
    @keyframes warn {
    0% {
    transform: scale(0);
    opacity: 0.0;
    }
    25% {
    transform: scale(0);
    opacity: 0.1;
    }
    50% {
    transform: scale(0.1);
    opacity: 0.3;
    }
    75% {
    transform: scale(0.5);
    opacity: 0.5;
    }
    100% {
    transform: scale(1);
    opacity: 0.0;
    }

    }

    </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

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

该问题目前已经被锁定, 无法添加新回复