95 this.sequences = []; |
95 this.sequences = []; |
96 this.popSeq.remove(); |
96 this.popSeq.remove(); |
97 } |
97 } |
98 }; |
98 }; |
99 |
99 |
100 this.createPopSequence = function(words, videosIndex) |
100 this.createPopSequence = function(words, videosIndex, paramIndex) |
101 { |
101 { |
102 if (!this.initDone) { |
102 if (!this.initDone) { |
103 this.loge("incplayer not initialized"); |
103 this.loge("incplayer not initialized"); |
104 return; |
104 return; |
105 } |
105 } |
106 |
106 |
107 // Delete previous popcorn objects |
107 // Delete previous popcorn objects |
108 this.destroySequence(); |
108 this.destroySequence(); |
109 |
109 |
110 // Choose the 3 videos |
110 // Choose the 3 videos |
111 this.choosePopSequence(words, videosIndex); |
111 this.choosePopSequence(words, videosIndex, paramIndex); |
112 |
112 |
113 // And init the popcorn sequence |
113 // And init the popcorn sequence |
114 this.initPopSequence(); |
114 this.initPopSequence(); |
115 }; |
115 }; |
116 |
116 |
117 this.playSingleVideo = function(videoUrl) |
117 this.playSingleVideo = function(videoUrl) |
118 { |
118 { |
119 this.sequences = []; |
119 this.sequences = []; |
|
120 this.singleVideo = true; |
120 var video = { name : "xxx", src: videoUrl, in: 0, out: "1.44" }; |
121 var video = { name : "xxx", src: videoUrl, in: 0, out: "1.44" }; |
121 this.sequences.push(video); |
122 this.sequences.push(video); |
122 this.formatPopSequence(); |
123 this.formatPopSequence(); |
123 this.initPopSequence(); |
124 this.initPopSequence(); |
124 this.singleVideo = true; |
|
125 } |
125 } |
126 |
126 |
127 this.choosePopSequence = function(wordsIndex, videosIndex) |
127 this.choosePopSequence = function(wordsIndex, videosIndex, paramIndex) |
128 { |
128 { |
129 this.sequences = []; |
129 this.sequences = []; |
130 |
130 |
131 if (videosIndex.length == 3) { |
131 if (paramIndex.length == 3) { |
|
132 // This is a shared link, we get the videos index from the url |
|
133 for (var i = 0; i < paramIndex.length; ++i) { |
|
134 this.sequences.push(this.allSequencesData.videos[paramIndex[i]]); |
|
135 } |
|
136 } else if (videosIndex.length == 3) { |
132 // The player got reloded, we use the previously choosen videos |
137 // The player got reloded, we use the previously choosen videos |
133 for (var i = 0; i < videosIndex.length; ++i) { |
138 for (var i = 0; i < videosIndex.length; ++i) { |
134 this.sequences.push(this.allSequencesData.videos[videosIndex[i]]); |
139 this.sequences.push(this.allSequencesData.videos[videosIndex[i]]); |
135 } |
140 } |
136 } else { |
141 } else { |
353 |
358 |
354 var pop = self.popSeq.eq(i); |
359 var pop = self.popSeq.eq(i); |
355 |
360 |
356 // Hide controls |
361 // Hide controls |
357 pop.controls(false); |
362 pop.controls(false); |
|
363 |
|
364 // Add poster on ipad |
|
365 if (self.ipad && !this.singleVideo) { |
|
366 $(pop.media).attr('poster', 'static/res/img/poster' + (i + 1) + '_video.png'); |
|
367 } |
358 |
368 |
359 // Play event |
369 // Play event |
360 self.listenEvent(pop, "playing", false, i, function(index) { |
370 self.listenEvent(pop, "playing", false, i, function(index) { |
361 self.displayPlayButton(false); |
371 self.displayPlayButton(false); |
362 self.logi("play sequence: " + self.sequenceToString(self.popSeq.active)); |
372 self.logi("play sequence: " + self.sequenceToString(self.popSeq.active)); |