new JSVideo()
Creates a video player pointing to files specified by the url
Methods
CreateVideoCanvas()
This function creates the html elements (display, scroll bar and buttons) for the video player
DisplayFrame(i)
This function displays the frame at position i, as well as the annotations corresponding to such frame.
If such frame is not available, it pauses the player, loads a chunk of frames starting from i and replays.
Parameters:
| Name | Type | Description |
|---|---|---|
i |
int | the index of the frame to be displayed |
GenerateFrames()
This function generates the html
elements that contain the loaded frames
GoToFrame(frame)
This function sets the player to frame 'frame'.
Parameters:
| Name | Type | Description |
|---|---|---|
frame |
int | the index of the frame of interest |
GoToFrameButtonClicked()
This function is called when the user clicks the Go to frame button. It displays the frame indicated by the text field
loadChunk(frame, duration, first_time)
This function loads a set of frames to the player.
Parameters:
| Name | Type | Description |
|---|---|---|
frame |
int | the first frame to load |
duration |
int | the duration of the chunk to be loaded |
first_time |
bool | boolean indicating whether the function is called for the first time |
loadFile(frame, first_time, response)
This function checks that the loaded frames are correct, stores them in the video structure
It prepares the polygon for scaling.
Parameters:
| Name | Type | Description |
|---|---|---|
frame |
int | the position corresponding to the first frame in the set |
first_time |
bool | boolean indicating whether it was the first frame load of the video |
response |
json | json with the set of jpg frames being loaded |
NextFrame()
Displays the next frame in a video file according to the video rate.
Play(buttonClicked)
This function sets the player to play. It can be called when a chunk of needed frames is loaded or when the user hits the play button.
Parameters:
| Name | Type | Description |
|---|---|---|
buttonClicked |
bool | boolean indicating whether the user clicked the play button or the video was played because the chunks got loaded |
seekChunkToDownload(frame)
This function looks for future frames that haven't been loaded yet and loads them into the player.
Parameters:
| Name | Type | Description |
|---|---|---|
frame |
int | the frame index from which to start seeking |
StepBackward()
This function goes to the previous frame.
StepBeginning()
This function goes to the start of the video.
StepEnd()
This function goes to the end of the video.
StepForward()
This function forces to go to the next frame, regardless of frame rate.
UpdateLoadbar(pos)
This function updates the position of the load bar.
Parameters:
| Name | Type | Description |
|---|---|---|
pos |
float | float from 0 to 1 indicating the position of the load bar |
UpdateScrollbar(pos)
This function updates the position of the scroll bar.
Parameters:
| Name | Type | Description |
|---|---|---|
pos |
float | float from 0 to 1 indicating the position of the scroll bar |