web/static/res/js/incplayer.js
changeset 93 7c37aaa2a8ae
parent 88 eeb0a6f3c07d
child 103 be6c1f9cc258
--- a/web/static/res/js/incplayer.js	Mon Jan 21 21:00:24 2013 +0100
+++ b/web/static/res/js/incplayer.js	Mon Jan 21 21:04:36 2013 +0100
@@ -97,7 +97,7 @@
 		}		
 	};
 
-	this.createPopSequence = function(words, videosIndex)
+	this.createPopSequence = function(words, videosIndex, paramIndex)
 	{
 		if (!this.initDone) {
 			this.loge("incplayer not initialized");
@@ -108,7 +108,7 @@
 		this.destroySequence();
 
 		// Choose the 3 videos
-		this.choosePopSequence(words, videosIndex);
+		this.choosePopSequence(words, videosIndex, paramIndex);
 
 		// And init the popcorn sequence
 		this.initPopSequence();
@@ -117,18 +117,23 @@
 	this.playSingleVideo = function(videoUrl)
 	{
 		this.sequences = [];
+		this.singleVideo = true;
        	var video = { name : "xxx", src: videoUrl, in: 0, out: "1.44" };
        	this.sequences.push(video);
        	this.formatPopSequence();
 		this.initPopSequence();
-		this.singleVideo = true;
 	}
 
-	this.choosePopSequence = function(wordsIndex, videosIndex)
+	this.choosePopSequence = function(wordsIndex, videosIndex, paramIndex)
 	{
 		this.sequences = [];
 
-		if (videosIndex.length == 3) {
+		if (paramIndex.length == 3) {
+			// This is a shared link, we get the videos index from the url
+			for (var i = 0; i < paramIndex.length; ++i) {
+				this.sequences.push(this.allSequencesData.videos[paramIndex[i]]);		
+			}
+		} else if (videosIndex.length == 3) {
 			// The player got reloded, we use the previously choosen videos
 			for (var i = 0; i < videosIndex.length; ++i) {
 				this.sequences.push(this.allSequencesData.videos[videosIndex[i]]);		
@@ -185,7 +190,7 @@
 			}
 
 			// Extention
-			v.src += "." + /*this.videoExt*/ "mp4"; // TODO
+			v.src += "." + this.videoExt;
 
 			// Set the final file
 			this.sequences[i] = v;
@@ -356,6 +361,11 @@
 			// Hide controls
 			pop.controls(false);
 
+			// Add poster on ipad
+			if (self.ipad && !this.singleVideo) {
+				$(pop.media).attr('poster', 'static/res/img/poster' + (i + 1) + '_video.png');
+			}
+
 			// Play event
 			self.listenEvent(pop, "playing", false, i, function(index) {
 				self.displayPlayButton(false);