c***@163.com
c***@163.com
  • 发布:2022-03-16 15:06
  • 更新:2022-03-18 11:12
  • 阅读:1248

createLivePusherContext报错:__WEEX_CALL_JAVASCRIPT__

分类:uni-app

reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: Cannot read property 'meta' of undefined

这是啥啊?每次一升级就有一堆问题

HBuilderX 3.3.13

this.livePusherCtx = uni.createLivePusherContext('livePusher', this);

就报错了,导致后面调 livePusherCtx 的各个方法都不行,因为是 null

以前的版本是好的,大概是 3.3.11 好像是 ok 的

2022-03-16 15:06 负责人:DCloud_uniAD_HDX 分享
已邀请:
c***@163.com

c***@163.com (作者)

@chenli @DCloud_HB_HXY 大佬们帮看一下

HBuilderX 3.3.13 或者 HBuilderX 3.4.2 alpha 都有这个问题

小枫叶

小枫叶 - 外包接单加v:wlmk1234567 注明来意

升级出现问题是很常见的,所以,如果着急用的话,先用上一个版本

  • c***@163.com (作者)

    关键是云打包也不支持你选版本啊,


    2022-03-17 09:55

  • 小枫叶

    回复 c***@163.com: 你的意思是,降了版本后云打包也出错?


    2022-03-17 20:33

  • c***@163.com (作者)

    回复 小枫叶: 云打包没法选版本,sdk 是 3.3.13,最新的


    2022-03-18 11:23

DCloud_uniAD_HDX

DCloud_uniAD_HDX

3.4.2 和 3.3.13 vue/nvue 测试正常,提供一个测试工程吧

<template>  
  <view class="content">  
    <live-pusher :url="url" id="livePusher1" ref="livePusher" class="live-pusher"></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 {  
        title: 'Hello',  
				url: ''  
      }  
    },  
    onReady() {  
      this.context = uni.createLivePusherContext("livePusher1", 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() {  
        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>  
  .content {  
    display: flex;  
    flex-direction: column;  
  }  
  
  .live-pusher {  
    width: 400px;  
    height: 320px;  
    background-color: #c0c0c0;  
  }  
</style>  

  • a***@sina.cn

    试了一下,独立页面用onReady的时候是正常的,但是如果移入组件(组件里不能用onReady只能用vue的生命周期钩子),之后把onReady改成其他生命周期函数就会报错,created、mounted还有beforeMount我都试了


    2023-02-28 18:23

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