Treehouse: Grow your CSS skills. Land your dream job.

How can I refresh the youtube flash video player with javascript?

  • # October 10, 2010 at 6:12 pm

    WARNING: For some reason, even though I’ve wrapped the code in the pre->code tags, it still implements the flash


    I’m struggling to find a way to refresh a flash instance with javascript.

    I am setting up a playlist type effect with the help of jQuery to replace the object settings with new ones.

    In firefox it works fine, but in all other browsers no luck.

    Here is part of the jQuery:

    var li_id = $(this).attr('id');


    $(this).parent().parent().find('object param[name=movie]').val('' + li_id);
    $(this).parent().parent().find('object embed').attr('src', '' + li_id);
    $(this).parent().parent().find('.current_title').attr('href', '' + li_id);
    $(this).parent().parent().find('.current_title').html( $(this).find('.youtube_link').html() );



    And here is an example of the HTML

    Any ideas? Thanks

    # October 11, 2010 at 10:47 am

    I think the rendering of the post above was messed up specialically because the links were to Seems like forums are tying to be helpful and turn links to youtube URL’s in to playable youtube videos. I fixed it by turning the URL’s to

    As far as refreshing the flash, I’d literally remove the object/embed and replace it entirely rather than trying to replace certain attributes of existing elements.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.