OggPlayJavascriptAPI: Difference between revisions
No edit summary |
No edit summary |
||
Line 46: | Line 46: | ||
This will automatically begin playing at the beginning if the state is PLAYING or FINISHED, but will remain paused ready to play at the beginning if the state is PAUSED. | This will automatically begin playing at the beginning if the state is PLAYING or FINISHED, but will remain paused ready to play at the beginning if the state is PAUSED. | ||
=== getPlayPosition === | |||
To get the current play position (in milliseconds) from the movie: | |||
int milliseconds <- getPlayPosition() | |||
=== setPlayPosition === | |||
To set the current play position (in milliseconds): | |||
boolean error <- setPlayPosition(int milliseconds) | |||
Note that if you set a position past the end of the movie then the result will be a play position at the end of the movie, and the player in FINISHED mode. | |||
Note also that certain servers (e.g. plain Ogg files, no mod-annodex installed, etc.) will prevent seeking from being able to occur past the buffered portion of the file; in this case, an error flag will be returned and the play position will be updated as far forward as possible. |
Revision as of 18:07, 10 May 2007
We want the OggPlay plugin to support both a simple individual movie mode, and a more fully-featured playlist mode. All of the functions supported in individual movie mode are still useful in playlist mode; however additional functions also become useful.
Individual movies
OggPlayState
enum OggPlayState { PAUSED = 0; PLAYING = 1; FINISHED = 2 };
These are fairly self-evident: the plugin begins in PAUSED or PLAYING state depending on the settings provided through the params tags, and changes to FINISHED state when the movie finishes playback.
getCurrentState
To retrieve the state:
int <- getCurrentState()
pause
pause()
This function will convert the PLAYING or FINISHED states to PAUSED.
play
play()
This function will convert the PAUSED state to PLAYING or FINISHED depending upon the current position within the movie.
restart
restart()
This function will convert any state to PLAYING, and start the movie again from the beginning
getCurrentMovie
To retrieve the currently playing (or just played, or about to play) movie:
string URL <- getCurrentMovie()
setCurrentMovie
To set a new movie:
setCurrentMovie(string URL)
This will automatically begin playing at the beginning if the state is PLAYING or FINISHED, but will remain paused ready to play at the beginning if the state is PAUSED.
getPlayPosition
To get the current play position (in milliseconds) from the movie:
int milliseconds <- getPlayPosition()
setPlayPosition
To set the current play position (in milliseconds):
boolean error <- setPlayPosition(int milliseconds)
Note that if you set a position past the end of the movie then the result will be a play position at the end of the movie, and the player in FINISHED mode.
Note also that certain servers (e.g. plain Ogg files, no mod-annodex installed, etc.) will prevent seeking from being able to occur past the buffered portion of the file; in this case, an error flag will be returned and the play position will be updated as far forward as possible.