Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked April 16th 2010 by Vince Lee
  • iphone
  • mobile
  • youtube
0 Comments

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>
    
    — answered April 16th 2010 by Kosso
    permalink
    1 Comment
    • Hi Kosso,

      Can you send me the full code? gustavo.msevero@gmail.com
      Thank you so much.

      — commented February 18th 2014 by Gustavo Severo
  • hi

    thanks for your reply - that is working better.

    however, i would still like to skip that intermediate step.

    1. i currently have a coverflow layout, displaying the videos' thumbnails.
    2. 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
    3. 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

    — answered April 16th 2010 by Vince Lee
    permalink
    0 Comments
  • 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)

    — answered April 16th 2010 by Kosso
    permalink
    0 Comments
  • 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!

    — answered April 16th 2010 by Vince Lee
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.