orizens/ngx-youtube-player

Angular 8 & Cordova - ngx-youtube-player not working on Android

Closed this issue · 1 comments

I'm using Angular 8, and in order to play and control Youtube videos I'm using ngx-youtube-player. On the browser everything is working fine. When building and rnning the app on Android using Cordova, the Youtube video doesn't show up. I tried to embed the video in a regular way, and it's working (I whitelisted the youtube url from the Cordova config).

This is my code: (On android the first video shows up, but second not)

<div class="container">
  <iframe width="560" height="315" src="https://www.youtube.com/embed/1ozGKlOzEVc" frameborder="0" allowfullscreen></iframe>
  <youtube-player videoId="eXvBjCO19QY" [width]="600" [height]="600"></youtube-player>
</div>

When trying to debug the app I get the following error on load:

www.youtube.com/iframe_api:1 Failed to load resource: net::ERR_INVALID_URL

When trying to start the video from my component controls I get a refernce error of course

ERROR ReferenceError: YT is not defined at t.playPauseSong (main.e0ff7e04d5915898ed07.js:1) at Object.handleEvent (main.e0ff7e04d5915898ed07.js:1) at Object.handleEvent (main.e0ff7e04d5915898ed07.js:1) at Object.handleEvent (main.e0ff7e04d5915898ed07.js:1) at Ti (main.e0ff7e04d5915898ed07.js:1) at main.e0ff7e04d5915898ed07.js:1 at e.i [as _next] (main.e0ff7e04d5915898ed07.js:1) at e.__tryOrUnsub (main.e0ff7e04d5915898ed07.js:1) at e.next (main.e0ff7e04d5915898ed07.js:1) at e._next (main.e0ff7e04d5915898ed07.js:1)

When using the developer tools on my app on Android it seems that the iframe element is missing from the component of the ngx-youtube-player package

Android HTML elements
https://i.stack.imgur.com/pnqrk.png

On the browser it looks like this: https://i.stack.imgur.com/gox25.png

What do I need to do in order to make the video from the ngx-youtube-player to work?

Thanks

Hi, have you solved the problem?