From 92c289e25642b99c498412c49a37eff1c59b4ced Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 9 Aug 2015 18:12:46 -0400 Subject: thinkin about the video --- public/js/lib/views/room/playlist.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'public/js/lib/views/room/playlist.js') 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 -- cgit v1.2.3-70-g09d2