Jquery - how i can get the video src value?

Posted by 3gwebtrain on Stack Overflow See other posts from Stack Overflow or by 3gwebtrain
Published on 2012-10-18T10:36:29Z Indexed on 2012/10/18 11:01 UTC
Read the original article Hit count: 135

Filed under:
|

i need to get the value of a video and need to change in to new value... for that i used this function:

var video = $('#task2ResultVideo').get(0);

console.log($(video).attr('poster')); // i am getting this

    $(video).attr('src',function(num,val){
        console.log(num,val)        // i am not getting this..
    }) ?

HTML:

<video id="task2ResultVideo" autobuffer poster="img/task2-results-host-poster.jpg">
    <source src="Video/webm/Task_2.4a_Host_treated.webm" type="video/webm" />
    <source src="Video/ogv/Task_2.4a_Host_treated.theora.ogv" type="video/ogg" />
    <source src="Video/MP4/Task_2.4a_Host_treated.mp4" type="video/mp4" />
</video>?

But i am not able to get the values. what is wrong with my code? in case if i get the value how can i change the src?

any suggestion please?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about video