Youtube UMG Content restricted on Ionic View

Hello and thank you for your help. I am attempting to build an ionic hybrid app which is similar to The idea is a place to build playlists of youtube music. In order to play youtube content I use the YouTube iframe api (the same that’s used in musicdrop). When I run my ionic app in the browser locally, it works as expected…the videos play. After I deploy using Ionic View when I play some videos I get “This video contains content from UMG. It is restricted from playback on certain sites.” This does not occur when testing on localhost.

Obviously it’s restricted from being played on the Ionic View app, and the only difference I can think of is the application origin. When I run it locally on my dev machine I believe it is sending the origin as “http://localhost:3000” or something to that effect so I suspect that “localhost” is an acceptable source. But when run in Ionic View it is failing so I suspect that it is sending “file://” as the source (this would correspond with the information I had to dig into to learn about CORS). That’s my best guess at least…it could certainly be something else.

Any suggestions?

Thank you.

Curious to know if you were able to fix this issue or if anyone out there knows of a fix?

Having the same problem. Any solutions yet?

It’s been a while so please forgive the lack of specifics. I was able to find a work-around but it’s ugly. It turns out that it is the application origin and if I remember correctly it’s because when Ionic View makes requests to YouTube it sends an application origin value of null. The only workaround I could find was to actually put my youtube player code on a website I own and then embed that in my app. So each time the app started it downloaded the player and embeded it in the UI. Because the YouTube player code originated from my website it would then send that website as the origin which allowed it to play videos. This introduced a problem however in that I could not directly listen for YouTube player events in my app. To work around this I caught the events in a .js file also loaded from the website and then used cross-document messaging to pass the event to the cordova app. Hope this helps.