hanumanDev
hanumanDev

Reputation: 6614

Youtube video won't play on iOS6 app but works when downloaded from the App Store

I have a Youtube video that was working fine in iOS 5 but now doesn't load in iOS 6. The strange thing is that if I download the app from the App Store the onto an iOS6 device the videos play fine. The problem is that if I build it on the device from XCode then the videos won't load. Same code, nothing changed. The difference is only if I build from XCode.

any idea what I might do to solve this?

thanks for any help.

Upvotes: 1

Views: 3849

Answers (1)

Walter
Walter

Reputation: 5887

From the iOS6 release notes

As of iOS 6, embedded YouTube URLs in the form of http://www.youtube.com/watch?v=oHg5SJYRHA0 will no longer work. These URLs are for viewing the video on the YouTube site, not for embedding in web pages. Instead, the format that should be used is described in https://developers.google.com/youtube/player_parameters.

I have had to update some of my projects so that when they run under iOS5 they use the old URL but in iOS6 they use the new URL which is basically http://www.youtube.com/v/oHg5SJYRHA0 (to use the example above).

I saw the same behaviour as you for my apps that are being sold in the store, they somehow continue to work.

EDIT: Here are the two string I am using in one of my apps.
iOS 5

<iframe width=\"%f\" height=\"%f\"src=\"http://www.youtube.com/embed/%@?showinfo=0&fs=1\" frameborder=\"0\" allowfullscreen\
        ></iframe>

and iOS6

<embed id=\"yt\" src=\"http://www.youtube.com/v/%@\" allowfullscreen type=\"application/x-shockwave-flash\" \
        width=\"%0.0f\" height=\"%0.0f\"></embed>

I have tried using the same iframe and shockwave code in both and just changing out the urls but it seems to be a combination of both that works for my testing.

Upvotes: 4

Related Questions