Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

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

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30509
    mattvot
    Member

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

    Hi,

    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:


    $('.current_youtube_video').parent().find('li.youtube_video').each(function(i)
    {
    //console.log($(this).attr('id'));
    var li_id = $(this).attr('id');

    $(this).click(function(){
    //alert($(this).attr('id'));

    $(this).parent().parent().find('object param[name=movie]').val('http://www.you-tube.com/v/' + li_id);
    $(this).parent().parent().find('object embed').attr('src', 'http://www.you-tube.com/v/' + li_id);
    $(this).parent().parent().find('.current_title').attr('href', 'http://www.you-tube.com/watch?v=' + li_id);
    $(this).parent().parent().find('.current_title').html( $(this).find('.youtube_link').html() );

    $(this).parent().parent().find('.current_youtube_video').show();
    $(this).parent().parent().find('.current_youtube_video').removeClass('current_youtube_video');
    $(this).addClass('current_youtube_video');
    $(this).hide();
    });

    });

    And here is an example of the HTML



    Any ideas? Thanks

    #78339
    Chris Coyier
    Keymaster

    I think the rendering of the post above was messed up specialically because the links were to youtube.com. 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 you-tube.com

    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.