开发者

YouTube video fails to load with iOS UIWebView

W're developing an iPad app (iOS 4.3.5) that uses UIWebView to load YouTube videos. About once in five times a YouTube video will fail to load and I only see the following blank screen with YouTube's logo:

YouTube video fails to load with iOS UIWebView

Looking in the debug logs I can only see the following warnings:

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.5 (8L1)/Symbols/System/Library/Internet Plug-Ins/QuickTime Plugin.webplugin/QuickTime Plugin (file not found).
warning: No copy of QuickTime Plugin.webplugin/Quick开发者_开发知识库Time Plugin found locally, reading from memory on remote device.  This may slow down the debug session.

I've read about this warning (https://stackoverflow.com/questions/7149593/warning-while-playing-a-video-link-in-my-app) and don't think it effects this problem.

Does anyone know how to fix this?


Try with video tag of HTML 5. I have done the same thing with video tag and its working perfect with my application.

Below is the sample code for the same...

<html><head><video controls=\"controls\"><source src=\"%@\" type=\"video/mp4\" height=\"%0.0f\" width=\"%0.0f\"/></video></body></html>


(Answering my own questions)

OK. I'm pretty sure I figured this out. Some videos don't have a mobile player. You can look at the JSON output here:

http://gdata.youtube.com/feeds/api/videos/TWfph3iNC-k?v=2&alt=jsonc

And here:

http://gdata.youtube.com/feeds/api/videos/cd4jvtAr8JM?v=2&alt=jsonc

Notice how the second video (cd4jvtAr8JM) doesn't have the mobile player link. I guess this means that YouTube hasn't encoded it yet for mobile. Or it's restricted for mobile. Regardless, these type of videos all won't play for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜