launching youtube player without intermediate youtube html
hello
i am retrieving youtube video entries from the youtube api, to launch from my app. from a previous post elsewhere, i have used the following:
var embed_html = '<html><head>' +
'<meta name="viewport" content = "initial-scale = 1.0, user-scalable = no, width = 320"/></head>' +
'<body style="background:#Fff;margin-top:0px;margin-left:0px">' +
'<div><object width="320" height="460">' +
'<param name="movie" value="' + path_to_video + '"></param>' +
'<param name="wmode" value="transparent"></param>' +
'<embed src="' + data[e.index].url +
'type="application/x-shockwave-flash" wmode="transparent" width="320" height="460"></embed>' +
'</object></div></body></html>';
var vid_view = Ti.UI.createWebView({
top: 0,
left: 0,
width: '100%',
height: '100%',
html: embed_html
});
where path_to_video is the url attribute of the player tag.
how can i make it so, on clicking the link, it launches the video directly into the youtube player, and not display the intermediate youtube page
cheers
vince
4 Answers
-
Accepted Answer
Hi,
Try this for your html, where the youTubeVideoID is the unique you tube 'watch' id:
<html><center> <object width="310" height="240"> <param name="movie" value="http://www.youtube.com/v/' + youTubeVideoID + '&hl=en_US&fs=1&"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/' + youTubeVideoID + '&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="310" height="240"></embed></object> </center></html>
-
hi
thanks for your reply - that is working better.
however, i would still like to skip that intermediate step.
- i currently have a coverflow layout, displaying the videos' thumbnails.
- clicking a thumbnail loads the above html in a webview, which in turn is opened by the current tab. this displays the big grey play image
- clicking this launches the video player
is there a way of missing step 2? i guess i could have each video launched from seperate webviews, displayed in a tableview, but would prefer to have the coverflow component :)
cheers
-
Hi,
Instead of using an imageView to show the thumbnail (if that's what you mean), simply use a webView containing that html.
That should work (I think)
-
yes, i am doing this instead; listing all the videos in a vertical column.
the coverflow component uses an array of image urls to display - don't think it will work with a load of webviews.
cheers!