Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-25-2012, 09:50 PM   PM User | #1
neutrino83
New Coder

 
Join Date: Apr 2012
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
neutrino83 is an unknown quantity at this point
html5 video currentFrame playback

Hi!

What I need is pretty simple:

When user clicks on a button, seek to a specific frame in html5 video and keep playing from there.

But my code here doesn't work. Instead of continuing playback from the new time (currentFrame) it will start from the beginning. How can I jump to a frame in my video and keep playing forward from there?

Here is my feeble attempt:

Code:
<div id="buttons">
<img class="choice01" src="btn_piano.jpg" onclick="jumpToTime();"/>
</div><!-- end buttons -->

<video id="videoclip"> <source src="video/testi.mp4"> your browser does not support the video tag</video>
Code:
function jumpToTime(){
   document.getElementById("videoclip").currentTime = 160;
   document.getElementById("videoclip").play();
};
neutrino83 is offline   Reply With Quote
Old 05-25-2012, 10:15 PM   PM User | #2
FutureWebDev
New Coder

 
Join Date: May 2012
Posts: 30
Thanks: 9
Thanked 0 Times in 0 Posts
FutureWebDev is an unknown quantity at this point
How about trying this. Not sure if it will work.
Code:
function jumpToTime(){
   document.getElementById("videoclip").currentTime = 160;
   document.getElementById("videoclip").currentTime;
};
So what your doing is setting the currentTime property to 160. Then your returning the currentTime property to the video element.

Actually you may not even need the second line. So if the above doesn't work, try deleting the second line.

Last edited by FutureWebDev; 05-25-2012 at 10:19 PM..
FutureWebDev is offline   Reply With Quote
Old 05-26-2012, 06:32 AM   PM User | #3
neutrino83
New Coder

 
Join Date: Apr 2012
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
neutrino83 is an unknown quantity at this point
The problem with that is that the playback gets stopped. And if I try to continue playback with

Code:
function jumpToTime(){
   document.getElementById("videoclip").currentTime = 160;
   document.getElementById("videoclip").currentTime;
   document.getElementById("videoclip").play();
};
then the playback always jumps to the beginning of the video..
neutrino83 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:25 AM.


Advertisement
Log in to turn off these ads.