-
Notifications
You must be signed in to change notification settings - Fork 1
5. Videoexample
Pieter van Leeuwen edited this page May 8, 2015
·
1 revision
-
The method makes video and controllers screen and checks if there's already an existing one
`public void onNewScreen(Screen s){` `if(videoScreen == null){` `videoScreen = s;` `initVideoScreen();` `}else{` `controllerScreen = s;` `initControllerScreen();` `}` `}` -
Here we initialize the video screen and we loead the style sheet
`private void initVideoScreen(){` `this.loadStyleSheet(videoScreen, "style");` `this.loadContent(videoScreen, "video", "video");` `}` -
Here we initialize the controller screen
`private void initControllerScreen(){` `this.loadContent(controllerScreen, "controller", "controller");`
3.1 Binds a listener to the play button on the controller screen. Calls the function "playButtonClicked" in this object.
`controllerScreen.setDiv("play", "bind:click", "playButtonClicked", this);`
-
Here we initialize the "play' and "pause" function
`public void playButtonClicked(Screen s, String content){` `playing = !playing;` `if(playing){` `this.setContent("play", "PAUSE");` `videoScreen.putMsg("video", "", "play()");` `}else{` `this.setContent("play", "PLAY");` `videoScreen.putMsg("video", "", "pause()");` `}` `}`