orizens / ngx-youtube-player

(ngx) A youtube component wrapped with Angular (typescript)

Home Page:https://www.npmjs.com/package/ngx-youtube-player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to play video with playVideo()

DetectiveFalcon opened this issue · comments

I currently have an angular application (14.2) and running 12.0 for the NGX-YT-Player have a dynamic set of slides sitting on an array. A slide can contain an image, text, or the videoID for display on the page.

The slide array randomizes, so that each time it loads it's a different order. I was able to install the component, and have it currently displaying the thumbnail of the video. I can also hit play from the UI.

I created a function called playVideo, in which I have my action to play the video like so:

PlayVideo(){

   if(this.player){
     this.player.playVideo();
     console.log("Play video")
   }

It calls the function and my console logs come up fine, but the video never starts. One thing that's worrying me is that my source (http://localhost) is making the YouTube API freak out and not let me make the calls. These are the errors I get on the console:
image