Get up to 80 % extra points for free! More info:

Discussion: Frame sequencing HTML code

Activities
Avatar
Andrew Martins:5/10/2020 21:30

Greetings everyone.

I am trying to build a video player with custom frame sequences. I need the code that allows me to change the code for the Play navigation command. Example: buttonPlay() nextframe=curren­tframe+1 ---------> buttonPlay() nextframe=curren­tframe+12
Where do I look for the code that defines Play or fastForward in an HTML video player? Is there any way for me to get an open source video player code package (HTML) ?

I found examples of code online that looks almost suitable for my purpose but I cannot find the files that contain that code so that I can edit it.

If you can help me out with HTML code that gives me a player with one button and instructions on where to find the code to edit the action of that button, I would be more than grateful. I would owe you one....

 
Reply
5/10/2020 21:30
Avatar
Replies to Andrew Martins
David Capka Hartinger:5/15/2020 10:31

Hi Andrew, the question is why you need such feature? Currently, there's no standard implementation and it's quite a problem. The reason is that video frames are synchronized with the display refresh rate and may vary. What can be done is:

  • change the playback speed
  • seek to a given time
  • if you knew the FPS of the video (can't be detected easily), you could theoretically just seek to a given time (frame) which you would compute based on the FPS. Not sure it wouldn't race with the monitor refresh rate.
  • seek to a given frame using an experimental API (only Firefox - https://developer.mozilla.org/…kToNextFrame). There are also some experimental features for Chrome, but it's complicated and has to be turned on in the browser settings - https://github.com/…ent/issues/4

I can't think of a need for seeking video frames instead of just skipping some small amount of time.

Up Reply
5/15/2020 10:31
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
Andrew Martins:5/15/2020 18:53

Thank you for the reply David. I believe I am on the right track with some code I just found online:

myButton.onRelease = function() {
 nextFrame();
 // a play method can be added, or any other actions performed
};

This code could perhaps work for the random frame sequence I need, but I also need to edit the PLAY function to reflect my custom sampling rate. Is there a way to do that in any existing code? So instead of playing every next frame, it should playback the frames by my values.

I wish I knew more about coding, so I'm going to make an effort to learn what I need to know for this task. If I knew anyone with Java skills and $30k I would offer them partnership on this project. I assure you, the need exists, even if you can't see it. It exists to the tune of $400m per annum.

My goal for now is to build a player with only 2 buttons to allow calibration of the cameras. Once calibration is complete I will know the exact values to add to the code. When the software build is ready, we start calibration and record a demo video to showcase the capabilities of the tech.

Please look at the file I attached and let me know if you think it can do the trick.

Thanks much

Edited 5/15/2020 18:54
 
Up Reply
5/15/2020 18:53
Avatar
Andrew Martins:5/15/2020 18:58
nextFrame

nextFrame()



This method is compatible with Flash 2 and later.



The nextFrame() method moves the playhead to the next frame and stops there. See also prevFrame(), MovieClip.nextFrame(), and MovieClip.prevFrame().
Description

The nextFrame() method moves the playhead to the next frame in the timeline, and stops playback at that point. See also MovieClip.nextFrame() for an explanation and examples.





Code






Additional explanation






Notes



nextFrame();






Moves the playhead to the next frame.






Playback is stopped when the nextFrame() method is called.





nextFrame(3);






No frame number can be specified; see gotoAndStop().






A frame number could be specified with this method in Flash 2 through Flash 4, but is not supported with Flash 5 and later.


Examples and practical uses

The nextFrame() method is used to move the timeline’s playhead to the next frame and stop there. It is often tied to an action such as a user clicking on a button. For example, if you have an intro Flash movie and want the user to click on a button to move on to the next part, you can stop the movie at one frame that has a button attached to it, and wait for the user to click the button. When they do, you move to the next frame:



on (release) {

 nextFrame();

 // a play method can be added, or any other actions performed

}



Using a button in a movie lets the user single-step through a movie’s frames, especially if there is tweened animation and you want to let the user pause at specific intervals in the movie. The code above is in Flash 5’s coding style. Flash MX and later releases allow the use of a function associated with a button. In this case, the button called myButton is used to call the function that moves to the next frame:



myButton.onRelease = function() {

 nextFrame();

 // a play method can be added, or any other actions performed

};
Tips and precautions

If you want to move to a specific frame, rather than then next frame, you can use the gotoAndPlay() or gotoAndStop() methods, referencing the current frame (using the _currentframe property) like this:



myButton.onRelease = function() {

 gotoAndPlay( _currentframe + 2);

};



In this case the code lets you move forward two frames instead of one using the nextFrame() method. The nextFrame() method is the same as writing:



gotoAndStop( _currentframe + 1);



The nextFrame() method does not return anything. See also prevFrame(), MovieClip.nextFrame(), and MovieClip.prevFrame().



If the nextFrame() method is invoked on the last frame of a timeline and there is no scene following, the playhead stops at that location. If there is a scene following the last frame of the current scene, the playhead moves to Frame 1 of the next scene.
 
Up Reply
5/15/2020 18:58
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

4 messages from 4 displayed.