YouTube player issues

Hi all,

I’m having an issue playing videos from YouTube - in some respects it’s working too well.

In my app I have lot’s of specially curated content from YouTube that we present and play in a normal webview using the standard iframe Youtube embed code.

My app currently has a 4+ content rating - however in the last upate a zealous Apple review rejected it due to the metadata.  Basically their argument was that because we could show ANY youtube video we had to make the app 12+

Having investigated the content ratings - to get a 12+ certificate it requires me select at least one of the following.

Frequent / Intense cartoon or fantasy violence
Infrequent / mild realistic violence
Frequent / Intense Profanity or Crude humor
Infrequent / Mild Medical / Treatment Information
Infrequent / Mild Alcohol, Tobacco or Drug Use or Referernces
Infrequent / Mild Simulated Gambling
Infrequent / Mild Sexual Content or Nudity

Obviously not what I’d want on my previously family friendly app page.

It would appear that the reviewer was able to get the youtube player to open the main youtube site within the webview (and then access the normal search), by pressing the YouTube icon on the player itself - which if you have the YouTube app installed will jump to the app otherwise the main site opens in the webview (did not know that!).

Anyway I’ve trawled through the net trying to find some way to turn off the “feature” and it’s possible to remove the logo by adding modestbranding=1 to the url, but then that displays a share feature at the top which does exactly the same - one press and bang, Youtube open in a webview.

Does anyone know any way (other than hosting the videos myself - not practical with almost 400 videos) to be able to either remove the share links OR prevent the webview from navigating away from the page?

Any help will be much appreciated.

I thought when you submitted your app one of the questions they asked was if the app user could get to generic web pages, which would trigger the 12+ rating.

I’ve not submitted in a while so it could be different now.

Rob

It didn’t ask that per-say, and to be honest it was a total shock to me when I saw the apple reviewer’s screenshots.

Ideally I’d like to keep my 4+ rating so I’m trying to find a way to stop it happening.

I’ve been looking into adding some extra javascript to try and block opening a new window or navigating away from the page but that doesn’t seem to work either.

The other approach is to try and find some way to extract the actual video stream out of the YouTube link and then play it directly using the media.* functions.

fwiw, my own kids’ first exposure to the breadth of youtube was via Cut The Rope - in theory they just present the Nom Nom cartoons, but you could easily break out of its “sandbox” and use it as a vanilla youtube browser, but they’ve somehow managed to retain their 4+ rating.  (been a while since then, so things may have changed, either in the app, or store, etc)

If you look at the attached screen shot from Apple, when setting ratings there is an option for “Unrestricted Web Access”. Now picking it sets the app to 17+ which you won’t want, but It may be work an email to the reviewers and ask for their suggestions if they are saying that your app needs to be 12+ (or 10+ or whatever) because of the webView, that’s a bit different than 17+. Maybe they can resolve the difference or  make suggestions.

Rob

I will chime in here with a solution for you…

What I would do is use the YouTube embed code on some simple self-hosted pages (they could even be .html pages included in your build).  Effectively you show only an embedded video (there are options to exclude recommended videos, annotations, etc).  This will lock it down to your content only and Apple should be happy.

More info here - https://developers.google.com/youtube/player_parameters

@Rob - to be honest I’m probably just going to take the hit on the rating and choose the least damaging rating option (and put a caveat in the description), Apple haven’t said what warnings I have to include, just that it must be 12+. @SphereGameStudios - that’s basically what I do. When the video overlay pops up, I generate a very simple HTML page which includes the YouTube embed code for the video I want to play and store it locally in the temp folder, I then point the web view at this temp file. The problem is that if you click on the YouTube icon or share link (if you manage to hide the icon using the modestbranding argument) then the web view opens the YouTube site. From what I can see there is no official way to stop this behaviour, I’ve even tried adding some JavaScript handlers to prevent leaving the page and they work on my links but not the YouTube ones - guess the Google engineers are smarter than me. :sunglasses:

Clearly you are wrong… I do this all the time (in my day job).

Here is one of my websites with embed code https://www.simplyswim.com/products/AquaSphere/EagleGoggles.aspx there is no way to break out of it to the main YouTube website.

Maybe you didn’t take the time to read the post about the params to add to the embed code.

i’m perhaps the LEAST qualified person in this forum to “lecture” ppl about their “tone” :D, because i come across wrong all the time, so take with a grain of salt, but…  let’s go easy on the guy.  i can easily break out of your eagle goggle’s video into full youtube, by just clicking the overlaid youtube logo before playing.  maybe it’s o/s- or browser-specific, but it took me literally NO TIME to “defeat” your sandbox.   (my kids taught me this trick :D)

If you set your video to auto play (in my example it was deemed inappropriate so it is disabled - not my decision blame management) then that is circumvented. Simply setting auto play = true fixes this. My point was once the video is playing you can’t escape it easily.

My point was the OP can achieve his aim without tripping Apples draconian rules.

I appreciate both your responses and to be honest @SphereGames, I DID look extensively through all the google docs on this AND I checked your page, regardless of setting auto play to true or not - the point is on the google embedded YouTube player running in a uiwebview there is no wa to prevent the player from dropping back to YouTube, all you have to do is touch the white semi transparent YouTube logo, regardless of whether or not you intended the behaviour it just is… Apple know this and therefore ANY app that plays YouTube content in this way potentially allows for unrestricted access to YouTube. The only way around this I can think of is to use some magic to extract the actual raw link to the MP4 file (there are libraries that supposedly do this) but its obviously against YouTube’s T’s & C’s and is subject to breaking if Google ever update their player. And I’ll happily give $100 via PayPal if you can provide me a script that doesn’t allow the main site to be accessed!

Hmm it would seem that since I left the company my code has been altered and that was a bad example (I really should of checked) sorry my bad!

Does something like this work for you? It is just a functional test

http://spheregamestudios.com/embed.htm

@SphereGamesStudio - I’ve sent you a PM :slight_smile:

I thought when you submitted your app one of the questions they asked was if the app user could get to generic web pages, which would trigger the 12+ rating.

I’ve not submitted in a while so it could be different now.

Rob

It didn’t ask that per-say, and to be honest it was a total shock to me when I saw the apple reviewer’s screenshots.

Ideally I’d like to keep my 4+ rating so I’m trying to find a way to stop it happening.

I’ve been looking into adding some extra javascript to try and block opening a new window or navigating away from the page but that doesn’t seem to work either.

The other approach is to try and find some way to extract the actual video stream out of the YouTube link and then play it directly using the media.* functions.

fwiw, my own kids’ first exposure to the breadth of youtube was via Cut The Rope - in theory they just present the Nom Nom cartoons, but you could easily break out of its “sandbox” and use it as a vanilla youtube browser, but they’ve somehow managed to retain their 4+ rating.  (been a while since then, so things may have changed, either in the app, or store, etc)

If you look at the attached screen shot from Apple, when setting ratings there is an option for “Unrestricted Web Access”. Now picking it sets the app to 17+ which you won’t want, but It may be work an email to the reviewers and ask for their suggestions if they are saying that your app needs to be 12+ (or 10+ or whatever) because of the webView, that’s a bit different than 17+. Maybe they can resolve the difference or  make suggestions.

Rob

I will chime in here with a solution for you…

What I would do is use the YouTube embed code on some simple self-hosted pages (they could even be .html pages included in your build).  Effectively you show only an embedded video (there are options to exclude recommended videos, annotations, etc).  This will lock it down to your content only and Apple should be happy.

More info here - https://developers.google.com/youtube/player_parameters

@Rob - to be honest I’m probably just going to take the hit on the rating and choose the least damaging rating option (and put a caveat in the description), Apple haven’t said what warnings I have to include, just that it must be 12+. @SphereGameStudios - that’s basically what I do. When the video overlay pops up, I generate a very simple HTML page which includes the YouTube embed code for the video I want to play and store it locally in the temp folder, I then point the web view at this temp file. The problem is that if you click on the YouTube icon or share link (if you manage to hide the icon using the modestbranding argument) then the web view opens the YouTube site. From what I can see there is no official way to stop this behaviour, I’ve even tried adding some JavaScript handlers to prevent leaving the page and they work on my links but not the YouTube ones - guess the Google engineers are smarter than me. :sunglasses:

Clearly you are wrong… I do this all the time (in my day job).

Here is one of my websites with embed code https://www.simplyswim.com/products/AquaSphere/EagleGoggles.aspx there is no way to break out of it to the main YouTube website.

Maybe you didn’t take the time to read the post about the params to add to the embed code.