| 类名 | 描述 |
|---|---|
| VHWatchLivePlayer | 播放器控制核心类 |
| VHWatchLivePlayerView | 播放器核心组件 |
| VHWatchLivePlayerCallback | 播放器事件回调 |
import { VHWatchLivePlayer} from "@vhall/vhall_live";
@Component
export struct VHWatchLivePlayerComponent {
@State message: string = 'Hello World';
/**
* 播放器控制类
* */
public livePlayer?:VHWatchLivePlayer = new VHWatchLivePlayer(this.getUIContext().getHostContext() as Context);
......
} build() {
Stack({ alignContent: Alignment.Center }){
// 播放器容器. 设置回调监听,播放器实例,播放器水印配置信息
VHWatchLivePlayerView({ componentListener: this, livePlayer: this.livePlayer,is_expand:this.is_expand, enableDefaultWaterMask:true,water:this.playerConfig?.water!})
.width('100%')
.height('100%')
.expandSafeArea(this.is_expand ? this.expandTypes : [], this.is_expand ? this.expandEdges : [])
.backgroundColor(Color.Black)
.align(Alignment.Center)
.zIndex(playerZIndex.indexOf(PLAYER_INDEX))
....
} public initWebinarInfo(webinarsInfo: VHWebinarData)| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| webinarsInfo | 是 | xx | 活动信息 |
aboutToAppear(): void {
this.livePlayer?.initWebinarInfo(this.webinars!);
} public setLivePlayerListener(listener: VHWatchLivePlayerCallback) aboutToAppear(): void {
this.livePlayer?.initWebinarInfo(this.webinars!);
this.livePlayer?.setLivePlayerListener(this);
} public startPlay(def: VHPlayDefinition) | 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| def |