diff options
Diffstat (limited to 'public/js/lib/views/room/playlist.js')
| -rw-r--r-- | public/js/lib/views/room/playlist.js | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/public/js/lib/views/room/playlist.js b/public/js/lib/views/room/playlist.js index 6da6ff9..6d81bf0 100644 --- a/public/js/lib/views/room/playlist.js +++ b/public/js/lib/views/room/playlist.js @@ -4,14 +4,43 @@ var PlaylistView = View.extend({ playlist: [], - initialize: function(){ + index: 0, + video: null, + + initialize: function(opt){ + this.video = new VideoView () + + opt.socket.on("add", function(){ + }) + opt.socket.on("position", function(){ + }) + opt.socket.on("remove", function(){ + }) + }, + + load: function(data){ + this.playlist = data.playlist + }, + + add: function(media){ + this.playlist.push(media) + }, + remove: function(){ + }, + + position: function(){ }, prev: function(){ + this.go( mod(this.index-1, playlist.length) ) }, next: function(){ + this.go( mod(this.index+1, playlist.length) ) }, + go: function(n){ + this.index = isNaN(n) ? n : this.index + this.video.load( playlist[this.index] ) }, })
\ No newline at end of file |
