Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying YouTube Video ads with YouTube iFrame

I'm currently developing an iOS app that displays my YouTube videos, I am a YouTube partner and video ads show up when I play my videos inside my browser. However while using the official iOS YouTube Player it doesn't show any kind of video ads whatsoever, does anyone know how to display video ads or get this fixed?

The YouTube Player Library I'm using https://github.com/youtube/youtube-ios-player-helper

Here are the parameters I'm using

  NSDictionary *playerVars = @{
                             @"controls" : @1,
                             @"playsinline" : @1,
                             @"autohide" : @0,
                             @"showinfo" : @0,
                             @"autoplay" : @1,
                             @"fs" : @0,
                             @"rel" : @0,
                             @"loop" : @1,
                             @"enablejsapi" : @1,
                             @"modestbranding" : @1
                             };

As you can see in this image it just starts playing the video and doesn't play any video ad before the video starts

enter image description here

like image 790
Jessica Avatar asked Oct 23 '14 18:10

Jessica


People also ask

Can embedded YouTube videos show ads?

Turn ads on or off on embedded videosIf you've associated your YouTube and AdSense accounts and have allowed embedding videos, you'll automatically be opted into showing ads. Note that embedded videos will honor the same ad enablement settings as videos on youtube.com.

Can you iframe a YouTube video?

Embed a video or playlistOn a computer, go to the YouTube video or playlist you want to embed. From the list of Share options, click Embed. From the box that appears, copy the HTML code. Paste the code into your website HTML.

Is it OK to embed YouTube videos?

But you're probably still wondering if it is safe to embed videos from YouTube? Well, generally speaking, providing a link to another website is not against the law. YouTube allows users to embed videos from its site by providing the html code to do so.


Video Answer


1 Answers

When the YTPlayerView iFrame loaded an ad, it used to force the user right out of their app and into Safari. I had opened an issue on the library's GitHub project page back in January and there was a discussion about it on StackOverflow here: Bug in 'YouTube iOS Player Helper' library.

Ultimately, iFrame ads were disabled in PR #58. This was sanctioned by Ibrahim Ulukaya, a member of YouTube's developer relations team.

With iFrame API subject to deprecation at any time, I wouldn't be surprised of YouTube was working on a better library for iOS, similar to the one they have for Android. But for now, ads will not show up in the YTPlayerView.

like image 79
JAL Avatar answered Oct 29 '22 05:10

JAL