0
votes

I have separate 3 folders, video1, video2, video3 - it all contains video1.mp4, video2.mp4, video3.mp4. by default, my html5 video has the video1-th folder's video1.mp4. but while the user click on other 2 thumbnail the video need to change according to the link what they click. so i need to change the src of the video.. for that i used this function

 $('#video2 img').click(function(){

    var id = $(this).parent().attr('id');
    var lastChar = id.substr(id.length - 1);
    alert(lastChar);

    var path = $('video').attr('src').substr(12,1);
    $(path).replaceWith(lastChar);
    alert(lastChar+'::'+path);

});

but not work well... i have 3 links with id of #video1, #video2, #video3 - all need to load separate video from their named folder.. any help?

1

1 Answers

0
votes

I got a solutions for this issue...

$('div.video-box-area img').click(function(){
       var nowSrc = $('video').attr('src');
       var change = nowSrc.replace(nowSrc.substr(12,1),$(this).parent().attr('id').substr(length-1));
       $('video').attr('src',change);
       return false;
});

thanks.