Nuevoplayer 8 Javascript API

RECEIVING NUEVOPLAYER EVENTS

Player ready
Load status
Current time
Totla time
Current state
Volume
Video quality


SENDING NUEVOPLAYER EVENTS


Load new video using javascript only
Check below complete javascript functions used to trace Nuevoplayer events received from above example.
<script type="javascript">
function updateEvent( event, v1, v2, id )
{
   switch(event)
   {
	case 'LOAD': 
	document.getElementById('currentLoad').value = v1+"%";
	break;

	case 'ITEM':
	document.getElementById('currentItem').value = v1;
	document.getElementById('currentID').value = v2;
	break;

        case 'TIME':
	document.getElementById('currentTime').value = time_format(v1);
	document.getElementById('elapsedTime').value = time_format(v2);
	break;
     
        case 'VOLUME':
	document.getElementById('currentVolume').value = v1; break;

	case 'HD':
		switch(v1)
		{
		case 1: 
	        document.getElementById('currentQuality').value = 'HD'; break;
		default:
	        document.getElementById('currentQuality').value = 'Normal'; break;
	}

        case 'STATE':

		var state = '';
		switch(v1)
		{
		case 0: state='PAUSED'; break;
		case 1: state='PLAYING'; break;
		case 2: state='BUFFERING'; break;
		case 3: state='COMPLETED'; break;
		case 4: state='IDLE'; break;
		}
		document.getElementById('currentSate').value = state;
		break;
   }
}
</script>
Check below javascript functions used to send Nuevoplayer events from example above.
<script type="text/javascript">
var player id;
function nuevoplayerReady( a ) {
   document.getElementById('ready').value = 'READY';
   player_id=a.id;
}
</script>
First we need to obtain player id value using function nuevoplayerReady as above.
function send_event ( event, value ) {
    var player = document.getElementById ( player_id );
    if ( value ) {
	    player.sendEvent ( event, value );
	} else {
	    player.sendEvent ( event );
	}
    }
} 
Now we can send events as in example above using sendEvent function.
We use it inside anoother function send_event.
First we obtain player object using player_id value that we have learned earlier using nuevoplayerReady function.
Then we can send event to player depending on Event parameter (with or without parameter).
List of events we sent in example above
send_event('pause');
send_event('play');
send_event('replay);
send_event('mute');
send_event('unmute')
send_event('volume',value);   //set some volume value 1-100
send_event('load', value);    //set some video URL to load it and play


All described javascript methods and events work in both, flash and html5 mode!