微信小程序直播获取用户openid参数
2020-08-21|HiShop
导读:微信小程序直播获取用户openid参数,【获取用户openid参数】接口(注:若要使用该接口,需在主包/分包先引入直播组件) 接口说明:在直播组件版本 1.1.4 及以上版本通过该接口获取用户...
微信小程序直播获取用户openid参数,【获取用户openid参数】接口(注:若要使用该接口,需在主包/分包先引入直播组件)
接口说明:在直播组件版本 1.1.4 及以上版本通过该接口获取用户openid参数。
调用方法:若要调用【获取用户openid参数】接口 getOpenid,需在小程序页面顶部引用【直播组件】 live-player-plugin。
示例代码如下:
let livePlayer = requirePlugin('live-player-plugin')
App({
onShow(options) {
livePlayer.getOpenid({ room_id: [直播房间id] }) // 该接口传入参数为房间号
.then(res => {
console.log('get openid', res.openid) // 用户openid
}).catch(err => {
console.log('get openid', err)
})
}
})