wx.createLivePusherContext()应该怎么传参数
发布于 6 年前 作者 li40 11529 次浏览 来自 问答

Page页面下使用<live-pusher/>组件,wx.createLivePusherContext()应该传什么参数?

官方demo是传控件的Id,官方文档是说传当前组件实例的this,

究竟要怎么传参数?在Page页面下

如果Page对应的wxml有以下组件,下面①②哪种写法是正确的呢?

<live-pusher id=“pusher” url=https://domain/push_stream mode=“RTC” autopush bindstatechange=“statechange” />

①:

Page({

onReady(res) {

this.ctx = wx.createLivePusherContext(‘pusher’)

},})

②:

Page({

onReady(res) {

this.ctx = wx.createLivePusherContext(this)

},})

回到顶部