Youtube Embedded Videos - View on Youtube


#1

Hello everyone

In my app I have one view where I display a list of youtube videos.
I’m using youtube iframe API and the videos are displayed fine in my view.

The problem is, when the user touches the Youtube watermark on the video to “view on youtube” the video opens on youtube app and the user can’t come back to the app.
Is there a way I can open the video fullscreen inside my app, without the “view on youtube” option?

On iOS the Youtube player has a “Done” button which goes back to the app, so that’s fine. Can’t I have the same behaviour on Android too?

Thank you!


#2

Add to url ?modestbranding=1 or &showinfo=0 you tube api

http://jsfiddle.net/mraranturnik/os2nc1Lm/


#3

It didn’t work.
The Youtube watermark still appears over the video.

Is there a way I can play the video fullscreen inside my app?


#4

I just faced the same issue within my app. There is a nice fix using html5 sandbox:

<iframe sandbox="allow-scripts allow-same-origin" width="560" height="315" ng-src="{{fullVideoUrl}}" frameborder="0" allowfullscreen></iframe>

Just update your iframe code to include:

sandbox="allow-scripts allow-same-origin"

For the full screen option add:

allowfullscreen

Hope that helps :wink:


#5

Does anyone know how to do this in a more native manner? So the the user doesn’t need to download the youtube app or embed an iframe? Currently, I don’t even have the “done” button. Also, I don’t really want to use the youtube lite lib just to get a “done” button.


#6

So, Apple doesn’t really like the idea of “disabling” YouTube’s feature,
the error from the sandbox is:

Blocked opening $URL in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.

Is there a way to catch that event and display something to the user instead ? ( Apple wants a “gateway” instead of disabling that button ) ( see my personal issue at: YouTube logo link is taking over the app )


#7

try to set this option, maybe it helps.