Iphone UIWebView embeds YouTube video
I use this code in my application to embed youtube video
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: transparent;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
URL of youtube videos from urlString, such as "http://www.youtube.com/v/QfWGRIlpNBE". And this code works great.
My question is, if the video is in flash format, then it cannot be played on iphone, and I have a criss-cross play button.
How to determine if youtube video is flash or H.264 format? I only have the video url.
If you need to know before creating your HTML, I think the only way is to use the YouTube API. You can request a video in your question as follows:
http://gdata.youtube.com/feeds/api/videos?q=QfWGRIlpNBE&max-results=1&v=2&format=1
H.263.
. http://code.google.com/apis/youtube/2.0/reference.html#formatsp API.
<iframe>:
http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html