实时音视频播放。相关api:wx.createLivePlayerContext
示例代码
WXML
| <live-player id="player" src="https://domain/pull_stream" autoplay bindstatechange="statechange" bindfullscreenchange="fullscreenchange" bindnetstatus="netstatus" />
 | 
JS
| Page({onReady: function() {
 this.context = wx.createLivePlayerContext('player');
 },
 statechange: function(e) {
 console.log('live-player statechange:', e.detail);
 },
 fullscreenchange: function(e) {
 console.log('live-player fullscreenchange:', e.detail);
 },
 netstatus: function(e) {
 console.log('live-player netstatus:', e.detail);
 }
 })
 
 | 
API
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
| src | string |  | 是 | 音视频地址。支持http协议、https协议(iOS支持)、rtmp协议 | 
| autoplay | boolean | false | 否 | 自动播放 | 
| muted | boolean | false | 否 | 是否静音 | 
| object-fit | string | contain | 否 | 填充模式 | 
| bindstatechange | eventhandle |  | 否 | 播放状态变化事件,detail = {code},状态如下 0:播放中 1:暂停播放 2:播放停止 3:播放结束 | 
| bindfullscreenchange | eventhandle |  | 否 | 全屏变化事件,detail = {fullScreen},状态如下 0:全屏 1:竖屏 | 
| bindnetstatus | eventhandle |  | 否 | 网络状态通知,detail = {info},状态如下 wifi:无线网络 wwan:移动网络 none:无网 | 
object-fit 合法值
| 属性 | 说明 | 
| contain | 图像长边填满屏幕,短边区域会被填充⿊⾊ | 
| fillCrop | 图像铺满屏幕,超出显示区域的部分将被截掉 | 
注释:
1.使用此接口,需要在平台打包时,在gmu文件夹下集成liveplayer.gmu
2.组件默认宽度300px、高度225px,可通过wxss设置宽高