tt.createLivePlayerContext
基础库 1.38.1 开始支持本方法,这是一个同步方法。
根据 <live-player /> 组件 id
创建可以控制组件的上下文 LivePlayerContext 对象。
语法
tt.createLivePlayerContext(id, component)
参数说明
id
类型 | 默认值 | 必填 | 说明 | 最低支持版本 |
---|---|---|---|---|
string | 是 | <live-player /> 组件的 id | 1.38.1 |
component
类型 | 默认值 | 必填 | 说明 | 最低支持版本 |
---|---|---|---|---|
object | 否 | 在自定义组件下,当前组件实例的 this,以操作组件内 <live-player /> 组件 | 1.38.1 |
返回值
扫码体验
请使用字节宿主APP扫码
代码示例
<live-player
src="http://1011.hlsplay.aodianyun.com/demo/game.flv"
id="myLivePlayer"
style="width: 240px; height: 180px;"
/>
Page({
livePlayerContext: undefined,
onReady() {
this.livePlayerContext = tt.createLivePlayerContext("myLivePlayer");
},
});
Bug & Tip
无
点击纠错
该文档是否对你的开发有所帮助?
有帮助
没帮助
该文档是否对你的开发有所帮助?
有帮助
没帮助