You are on page 1of 1

VARIABLES STRUCTURE JAVASCRIPT API

backgroundcolor (FFFFFF) Since Silverlight programming is done in


windowless (false) Player javascript, the player is easily accessible.
height (260) composites Javascript has already got a reference to
width (320) the player through the instantiation:
configuration (list with variables)

duration (0) var ply = new jeroenwijering.Player(cnt,src,cfg);


file (null) Model
image (null) Requesting a configuration variable can be
link (null) done through this reference:
goPause(seconds)
start (0)
goStart(seconds) alert(’the file is: ’+ply.getConfig().file);
goStop()
backcolor (FFFFFF)
goVolume(percentage) The player can be controlled by sending
frontcolor (000000)
lightcolor (000000) events. Each function of Controller is
manages media playback named after these events. Examples:
screencolor (000000)

logo (null) ply.sendEvent(’PLAY’);


overstretch (false) Controller ply.sendEvent(’VOLUME’,50);
shownavigation (true) ply.sendEvent(’LOAD’,’newvideo.wmv’);
View
showstop (false) setState (oldstate,newstate)
showdigits (true) setLink() Finally, you can assign your own functions
onState(oldstate,newstate) setLoad(file) to listen to specific events of the player.
autostart (false) onBuffer(percentage) setMute() Each function of View is named after the
bufferlength (3) onFullscreen() setPlay() corresponding event:
linkfromdisplay (false) onLoad(percentage) setScrub(seconds)
linktarget (_self) onMute() setStop() ply.addListener(‘VOLUME’,alert);
repeat (false) onTime(elapsed,total) setVolume(percentage) function myFunc(old,new) {
sender (null) onVolume(percentage) setFullscreen() alert(’the state went from ’+old+’ to ‘+new);
usefullscreen (true) };
usemute (false) draws all controls of the player handles all user input ply.addListener(‘STATE’,myFunc);
volume (90)

When the Player starts, it first loads the configuration list and places the graphics on Note that the state event can have the
the page. Next, Controller, Model and View are created. They now start calling each values Buffering, Closed, Error, Opening,
others’ functions in a so-called MVC loop. Model calls the functions from View, View Paused, Playing, Stopped, or Completed.
those from Controller and Controller those from Model. There is one exception: Model
calls both the onState() from View and the setState() from Controller.

You might also like