微信小程序实时音视频播放组件live-player v2.9.1 起支持同层渲染。
根据微信官方提示,暂只针对国内主体如下类目的小程序开放。需要先通过类目审核,再在小程序管理后台,「开发」-「接口设置」中自助开通该组件权限。
类目可参考:https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html
示例代码:
<live-player src="https://domain/pull_stream" mode="RTC" autoplay bindstatechange="statechange" binderror="error" style="width: 300px; height: 225px;" />
Page({
statechange(e) {
console.log('live-player code:', e.detail.code)
},
error(e) {
console.error('live-player error:', e.detail.errMsg)
}
})
小窗特性说明:
live-player 小窗支持以下三种触发模式(在组件上设置 picture-in-picture-mode 属性):
1、push 模式,即从当前页跳转至下一页时出现小窗(页面栈push);
2、pop 模式,即离开当前页面时触发(页面栈pop);
3、以上两种路由行为均触发小窗。
暂无评论,抢个沙发...