我目前正在使用 Angular 项目,制作一个观看视频的网站。我使用 Videogular 是一个开发视频应用程序的框架。我不知道如何默认全屏制作视频。
我的代码:
<vg-player (onPlayerReady)="onPlayerReady($event)" >
<vg-overlay-play></vg-overlay-play>
<vg-buffering></vg-buffering>
<vg-scrub-bar>
<vg-scrub-bar-current-time></vg-scrub-bar-current-time>
<vg-scrub-bar-buffering-time></vg-scrub-bar-buffering-time>
</vg-scrub-bar>
<vg-controls>
<vg-play-pause></vg-play-pause>
<vg-playback-button></vg-playback-button>
</vg-controls>
<h1>{{id}}</h1>
<video [vgMedia]="media" #media id="singleVideo" preload="auto" crossorigin>
<source src="assets/skill/skill_{{id}}.mp4" type="video/mp4">
</video>
</vg-player>
import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {VgAPI} from 'videogular2/compiled/src/core/services/vg-api';
@Component({
selector: 'app-skill',
templateUrl: './skill.component.html',
styleUrls: ['./skill.component.css']
})
export class SkillComponent implements OnInit {
id: string;
constructor(private route: ActivatedRoute) {
route.params.subscribe(params => {
this.id = params['id'];
});
}
ngOnInit() {
}
onPlayerReady(vgAPI: VgAPI) {
vgAPI.play();
vgAPI.fsAPI.toggleFullscreen();
}
}
非常感谢!