I Can Has Video

As you’ve probably noticed, movies rarely work in I Can Has Cheezburger app (as a work-around, you can open the web page and click the video to play it).

The reason it doesn’t work is the movie URL returned in the feed, which is something like http://www.youtube.com/v/cxLG2wtE7TM won’t work when passed directly to a UIWebView or sent to youtube to handle. If you look at the ICHC web page containing the video, you’ll see an embed tag containing that movie URL, which a webview is able to handle correctly.

I came up with a very simple way to make videos work reliably: I create a HTML string with an EMBED tag containing the movie URL. Instead of opening the movie URL directly using UIWebView loadRequest:, I open the HTML document I built with loadHTMLString:. You’ll now have a clickable movie thumbnail, which will open in the standard YouTube player without exiting the application.

Leave a Comment