Playback preparations:
gSTB.InitPlayer();
gSTB.SetAspect(0x10);
gSTB.SetVideoControl(0);
gSTB.SetVideoState(0);
gSTB.SetTopWin(0);
gSTB.SetViewport(800, 600, 0, 500);
Event model initialization:
window.stbEvent = {
onEvent: function ( event ) {
switch ( Number(event) ) {
case 2:
console.log('Information on audio and video tracks of the media content is received.');
break;
case 4:
console.log('Video playback has begun.');
break;
}
}
};
Play video with auto
solution:
gSTB.Play('auto http://www.mediacollege.com/downloads/video/timecode/tc_25fps_20mins.m2v');
Player manipulations on user input:
window.addEventListener('keydown', function ( event ) {
var volume = gSTB.GetVolume();
switch ( event.keyCode ) {
case 107:
console.log('keydown: volume up');
gSTB.SetVolume(volume++);
break;
case 109:
console.log('keydown: volume down');
gSTB.SetVolume(volume--);
break;
case 83:
if ( event.altKey ) {
console.log('keydown: stop');
gSTB.Stop();
}
break;
}
});