Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bug in 'YouTube iOS Player Helper' library

Tags:

youtube-api

I have been using the 'YouTube iOS Player Helper' library for playback of our youtube videos in our iOS App (iPhone).

Today I noticed a bug in the same, whenever it tries to load a video with 'In Stream Ads' it pauses the playback of video, closes our app and then opens mobile safari app with the link to "pubads.g.doubleclick.net" page. The page loads with a blank screen.

I repeatedly checked the app, this behaviour is consistent with all YouTube videos with 'In Stream Ads'. Also a video without any ads is working ie playing fine in the app without triggering mobile safari.

Any ideas on when this bug will be resolved?

I'm using iOS 8.1.2 (12B440) on iTouch 5th generation. I also get the same result in iPhone simulator also.

Thanks :)

like image 308
apostleofzion Avatar asked Jan 07 '15 13:01

apostleofzion


People also ask

What is YouTube iOS player helper?

The youtube-ios-player-helper is an open source library that helps you embed a YouTube iframe player into an iOS application.

How do I embed a YouTube video in iOS Swift?

In this example, we are going to add the YouTube Player iOS Helper library into our project using Cocaopods. Next, in the swift file of your ViewController, add with drag and drop the YTPlayerView and add import youtube_ios_player_helper at the top of your file.


1 Answers

A temporary solution (until this problem is fixed) is adding another condition in the method shouldStartLoadWithRequest() that is located in the file YTPlayerView.m. The condition should intercept requests made to pubads.g.doubleclick.net.

The following lines solved the problem for me:

else if ([request.URL.host isEqual: @"pubads.g.doubleclick.net"])
{
         return NO; 
} 
like image 56
khaled Avatar answered Oct 21 '22 15:10

khaled