diff --git a/example/samples/dist/TextDisplay.js b/example/samples/dist/TextDisplay.js index 69928e6..bb05f8e 100644 --- a/example/samples/dist/TextDisplay.js +++ b/example/samples/dist/TextDisplay.js @@ -411,7 +411,6 @@ var TimeAction = function () { }, { key: "trigger", value: function trigger() { - console.log(this, this.args); this.action.apply(this, this.args); } }]); @@ -611,6 +610,17 @@ var TextDisplay = function (_Display) { value: function handleTick() { this.timeline.callTimeAction(this.context.time); } + }, { + key: "recordText", + value: function recordText(time, text) { + this.timeline.addTimeAction(time, this.showText.bind(this), text); + } + }, { + key: "recordHTML", + value: function recordHTML(time, html) { + this.timeline.addTimeAction(time, this.showRichText.bind(this), html); + } + /** * prepareTimeline is placeholder for how a TextDisplay instance loads * time actions to it's timeline. diff --git a/example/samples/dist/YoutubeDisplay.js b/example/samples/dist/YoutubeDisplay.js index 5d57ceb..1ea211c 100644 --- a/example/samples/dist/YoutubeDisplay.js +++ b/example/samples/dist/YoutubeDisplay.js @@ -411,7 +411,6 @@ var TimeAction = function () { }, { key: "trigger", value: function trigger() { - console.log(this, this.args); this.action.apply(this, this.args); } }]); @@ -569,11 +568,6 @@ var YoutubeDisplay = function (_Display) { this.player.stopVideo(); clearInterval(this.counter); } - }, { - key: "prepareTimeline", - value: function prepareTimeline() { - console.log("Prepare Timeline"); - } }, { key: "handleTick", value: function handleTick() { @@ -581,6 +575,9 @@ var YoutubeDisplay = function (_Display) { var t = this.context.time; this.timeline.callTimeAction(this.context.time); } + + //Controll the size yourself you bums + }, { key: "setupPlayer", value: function setupPlayer() { @@ -593,10 +590,19 @@ var YoutubeDisplay = function (_Display) { } }); } + }, { + key: "tick", + value: function tick() { + if (this.isPrimaryDisplay()) { + this.context.emitter.emit('tick'); + //Replaced tick with the youtube based time + this.context.time = Math.round(this.player.getCurrentTime()); + console.log(this.context.time); + } + } }, { key: "setup", value: function setup() { - this.prepareTimeline(); this.firstScriptTag = document.getElementsByTagName('script')[0]; this.firstScriptTag.parentNode.insertBefore(this.script_tag, this.firstScriptTag); window.onYouTubeIframeAPIReady = this.setupPlayer.bind(this); diff --git a/example/samples/text_display.js b/example/samples/text_display.js index 308e248..06d5e32 100644 --- a/example/samples/text_display.js +++ b/example/samples/text_display.js @@ -48,6 +48,18 @@ class TextDisplay extends Display { handleTick() { this.timeline.callTimeAction(this.context.time); } + + + + recordText(time, text) { + this.timeline.addTimeAction(time, this.showText.bind(this), text); + + } + recordHTML(time, html) { + this.timeline.addTimeAction(time, this.showRichText.bind(this), html); + } + + /** * prepareTimeline is placeholder for how a TextDisplay instance loads * time actions to it's timeline. diff --git a/example/samples/youtube_display.js b/example/samples/youtube_display.js index acffe4c..b638c52 100644 --- a/example/samples/youtube_display.js +++ b/example/samples/youtube_display.js @@ -22,16 +22,13 @@ class YoutubeDisplay extends Display { clearInterval(this.counter); } - prepareTimeline(){ - console.log("Prepare Timeline"); - } - handleTick(){ var th = this.timeline.treshold; var t = this.context.time; this.timeline.callTimeAction(this.context.time); } + //Controll the size yourself you bums setupPlayer(){ this.player = new YT.Player(this.player_id, { height: '390', @@ -43,8 +40,16 @@ class YoutubeDisplay extends Display { }); } + tick() { + if (this.isPrimaryDisplay()) { + this.context.emitter.emit('tick'); + //Replaced tick with the youtube based time + this.context.time = Math.round(this.player.getCurrentTime()); + console.log(this.context.time); + } + } + setup(){ - this.prepareTimeline(); this.firstScriptTag = document.getElementsByTagName('script')[0]; this.firstScriptTag.parentNode.insertBefore(this.script_tag, this.firstScriptTag); window.onYouTubeIframeAPIReady = this.setupPlayer.bind(this); @@ -58,7 +63,6 @@ class YoutubeDisplay extends Display { this.player.playVideo(); this.counter = setInterval(this.tick.bind(this), this.t_ratio); } - }; module.exports = YoutubeDisplay; diff --git a/example/video_coordinated.html b/example/video_coordinated.html index 0d1e3bd..1483206 100644 --- a/example/video_coordinated.html +++ b/example/video_coordinated.html @@ -81,23 +81,19 @@

DisplayCoordinator example

canvas_class: "sideView"}); var htmlTest = - '
' + '"Hello, World!" program - Wikipedia' + '
' - - td.prepareTimeline = function() { - this.timeline.addTimeAction(4, this.showRichText.bind(this), htmlTest); - this.timeline.addTimeAction(10, this.showRichText.bind(this), 'Welcome to Python.org

The official home of the Python Programming Language

'); - this.timeline.addTimeAction(12, this.showRichText.bind(this), 'How to user Linux Terminal
How to use CMD'); - this.timeline.addTimeAction(18, this.showRichText.bind(this), 'Download Python

The official home of the Python Programming Language

'); - this.timeline.addTimeAction(30, this.showRichText.bind(this), 'Vim (text editor) - Wikipedia

Vim (; a contraction of Vi IMproved) is a clone of Bill Joy\'s vi text editor program for Unix. It was written by Bram Moolenaar based on source for a port of the Stevie editor to the Amiga and first released publicly in 1991.

'); - this.timeline.addTimeAction(41, this.showRichText.bind(this), 'Python Docs'); - } - + td.recordHTML(4, htmlTest); + td.recordHTML(10, 'Welcome to Python.org

The official home of the Python Programming Language

'); + td.recordHTML(12, 'How to user Linux Terminal
How to use CMD'); + td.recordHTML(18, 'Download Python

The official home of the Python Programming Language

'); + td.recordHTML(30, 'Vim (text editor) - Wikipedia

Vim (; a contraction of Vi IMproved) is a clone of Bill Joy\'s vi text editor program for Unix. It was written by Bram Moolenaar based on source for a port of the Stevie editor to the Amiga and first released publicly in 1991.

'); + td.recordHTML(41, 'Python Docs'); td.setAsReady(); + var DisplayCoordinator = Displays.DisplayCoordinator; var lesson_coordinator = new DisplayCoordinator({ stage: { diff --git a/src/timeline.js b/src/timeline.js index 39765b0..c93051d 100644 --- a/src/timeline.js +++ b/src/timeline.js @@ -23,7 +23,6 @@ class TimeAction { * Trigger an action by calling *func* and passing it *args* passed from initialization. */ trigger(){ - console.log(this, this.args); this.action.apply(this, this.args); } };