我需要知道如何使用VgFullscreenAPI。官方文件帮不上忙。
这就是我所拥有的:
<vg-player
(onPlayerReady)="onPlayerReady($event)"
(onChangeFullscreen)="toggleFullscreen($event)">
<vg-play-pause #playBtn class="play-btn">
<span class="vg-icon-play_arrow"></span>
</vg-play-pause>
<vg-controls [vgAutohide]="true" [vgAutohideTime]="4" >
<vg-play-pause</vg-play-pause>
<vg-mute></vg-mute>
<vg-fullscreen class="ml-auto"></vg-fullscreen>
</vg-controls>
<video #media
[vgMedia]="media"
[attr.id]="post.id"
preload="none"
[poster]="post.thumbnail"
(click)="onVideoClick()"
loop>
<source [src]="post.source" type="video/mp4">
</video>
</vg-player>
toggleFullscreen($event){
console.log($event);
}我尝试过在vg-plater、vg-fullscreen和video标记上使用输出事件发射器vg-plater。
发布于 2018-11-23 20:56:33
事件由VgFullscreenAPI服务在VgPlayer中提供,您可以在组件类中像这样访问它:
@ViewChild(VgPlayer) vgPlayer: VgPlayer;
ngAfterViewInit(): void {
this.vgPlayer.fsAPI.onChangeFullscreen.subscribe((event) => {
this.toggleFullscreen(event);
});
}不知道他们为什么在服务中把它变成一个EventEmitter。似乎他们还没有真正理解新的角形版本:)
https://stackoverflow.com/questions/53452733
复制相似问题