'Video.js give error "youtube" is undefined while playing youtube video
@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 give error "youtube" is undefined while playing youtube video
Error :
video.es.js:439 VIDEOJS: ERROR: The "youtube" tech is undefined. Skipped browser support check for that tech.
Solution 1:[1]
This works for me with package.json
"video.js": "^7.17.0",
"videojs-youtube": "^2.6.1",
js file, basically videojsYoutube does nothing but initialize Youtube Tech.
import videojs from "video.js";
import videojsYoutube from "videojs-youtube";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Than Ngo Hoai |
