-function monitor()
-{
- var vlc = getVLC("vlc");
- var newState = 0;
-
- if( vlc )
- {
- newState = vlc.input.state;
- }
-
- if( prevState != newState )
- {
- if( newState == 0 )
- {
- // current media has stopped
- onEnd();
- }
- else if( newState == 1 )
- {
- // current media is openning/connecting
- onOpen();
- }
- else if( newState == 2 )
- {
- // current media is buffering data
- onBuffer();
- }
- else if( newState == 3 )
- {
- // current media is now playing
- onPlay();
- }
- else if( newState == 4 )
- {
- // current media is now paused
- onPause();
- }
- else if( newState == 5 )
- {
- // current media has stopped
- onStop();
- }
- else if( newState == 6 )
- {
- // current media has ended
- onEnd();
- }
- else if( newState == 7 )
- {
- // current media encountered error
- onError();
- }
- prevState = newState;
- }
- else if( newState == 3 )
- {
- // current media is playing
- onPlaying();
- }
- if( monitorTimerId == 0 )
- {
- monitorTimerId = setInterval("monitor()", 1000);
- }
-};
-