@Component({
selector: 'invidz-video-js-component',
template: `
<div id="full-background">
<video
id="vid"
class="video-js vjs-default-skin vjs-fullscreen vjs-big-play-centered"
controls
data-setup='{ "techOrder": ["youtube"]}'
>
<source type="video/youtube" [src]="videoUrl"/>
</video>
</div>
`,
`]
})
export class VideoJsComponent implements OnInit, AfterViewInit {
@Input() videoUrl: string;
@Input() autoPlay: string;
private player: any;
constructor() {
}
ngOnInit() {
console.log(this.autoPlay);
console.log(this.videoUrl);
}
ngAfterViewInit() {
this.player = videojs(document.getElementById('vid'));
this.player.on('ended', function() {
});
}
}
Video.js会出错&#34; youtube&#34;播放YouTube视频时未定义
错误:
video.es.js:439 VIDEOJS:错误:&#34; youtube&#34;技术未定义。 跳过浏览器支持检查该技术。