Video.js 播放 YouTube 视频时出现错误“youtube”未定义

2024-01-21

 @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 播放 YouTube 视频时出现错误“youtube”未定义

Error :

video.es.js:439 VIDEOJS:错误:“youtube”技术未定义。 跳过了对该技术的浏览器支持检查。


这对我有用 包.json

    "video.js": "^7.17.0",
    "videojs-youtube": "^2.6.1",

js 文件,基本上 videojsYoutube 除了初始化 Youtube Tech.js 之外什么也不做。

import videojs from "video.js";
import videojsYoutube from "videojs-youtube";
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Video.js 播放 YouTube 视频时出现错误“youtube”未定义 的相关文章

随机推荐