Browse Source

play2.js gestion de base du jamendo (refact restante)

Sevajol Bastien 12 years ago
parent
commit
4fc29e0dd8

+ 6 - 5
src/Muzich/CoreBundle/Resources/public/js/play.js View File

524
    * @param {string} title Nom du morceau qui sera affiché dans la liste de lecture
524
    * @param {string} title Nom du morceau qui sera affiché dans la liste de lecture
525
    * @param {string} mp3 adresse du flux sonore
525
    * @param {string} mp3 adresse du flux sonore
526
    */
526
    */
527
-  function GenericSong(title, mp3)
528
-  {
529
-    this.title = title;
530
-    this.mp3   = mp3;
531
-  }
527
+   // EN COMMENTAIRE CAR CODE COPIE VERS play2.js
528
+  //function GenericSong(title, mp3)
529
+  //{
530
+  //  this.title = title;
531
+  //  this.mp3   = mp3;
532
+  //}
532
   
533
   
533
   /**
534
   /**
534
    * Fonction de lecture d'un élèment avec le lecteur générique
535
    * Fonction de lecture d'un élèment avec le lecteur générique

+ 93 - 0
src/Muzich/CoreBundle/Resources/public/js/play2.js View File

23
     {
23
     {
24
       return new SoundCloudPlayer(ref_id, object_for_player);
24
       return new SoundCloudPlayer(ref_id, object_for_player);
25
     }
25
     }
26
+    if (player_type == 'jamendo.com')
27
+    {
28
+      return new JamendoPlayer(element_id, object_for_player);
29
+    }
30
+    
26
     return new GenericPlayer(element_id, object_for_player);
31
     return new GenericPlayer(element_id, object_for_player);
27
   }
32
   }
28
   
33
   
191
   }
196
   }
192
 }
197
 }
193
 
198
 
199
+function GenericSong(title, mp3)
200
+{
201
+  this.title = title;
202
+  this.mp3   = mp3;
203
+}
204
+
205
+function JamendoPlayer(ref_id, object_for_player)
206
+{
207
+  var _ref_id = ref_id;
208
+  var _object_for_player = object_for_player;
209
+  var _playlist = new Array();
210
+  
211
+  this.play = function()
212
+  {
213
+    create_player();
214
+  }
215
+  
216
+  var create_player = function()
217
+  {
218
+    // TODO efactoriser dans un objet lecteur generique
219
+    var jplayer_player  = $('#jquery_jplayer_1').clone();
220
+    var jplayer_content = $('#jp_container_1').clone();
221
+    
222
+    jplayer_player.attr ('id', 'jplayer_player_element_'+ref_id);
223
+    jplayer_content.attr('id', 'jplayer_content_element_'+ref_id);
224
+    
225
+    _object_for_player.html('');
226
+    _object_for_player.append(jplayer_player);
227
+    _object_for_player.append(jplayer_content);
228
+    
229
+    JQueryJson(url_element_get_stream_data+'/'+ref_id, {}, function(response){
230
+      if (response.status == 'success')
231
+      {
232
+        
233
+        for(var i = 0; i < response.data.length; i++)
234
+        {
235
+          var song = new GenericSong(response.data[i].name, response.data[i].url);
236
+          _playlist[i] = song;
237
+        }
238
+        
239
+        autoplay_generic_player_playlist = new jPlayerPlaylist
240
+        (
241
+          {
242
+            jPlayer: '#jplayer_player_element_'+ref_id,
243
+            cssSelectorAncestor: '#jplayer_content_element_'+ref_id
244
+          },
245
+          _playlist,
246
+          {
247
+            playlistOptions:
248
+            {
249
+              autoPlay: true,
250
+              enableRemoveControls: true
251
+            },
252
+            swfPath: "/jplayer/js",
253
+            supplied: "mp3",
254
+            wmode: "window"
255
+          }
256
+        );
257
+        
258
+        $('#jplayer_player_element_'+ref_id).bind($.jPlayer.event.play, event_play);
259
+        $('#jplayer_player_element_'+ref_id).bind($.jPlayer.event.ended, event_end);
260
+        $('#jplayer_player_element_'+ref_id).bind($.jPlayer.event.error, event_error);
261
+        
262
+      }
263
+    });
264
+  }
265
+  
266
+  var event_play = function(event)
267
+  {
268
+    
269
+  }
270
+  
271
+  var event_end = function(event)
272
+  {
273
+    
274
+  }
275
+  
276
+  var event_error = function(event)
277
+  {
278
+    
279
+  }
280
+  
281
+  this.stop = function()
282
+  {
283
+    
284
+  }
285
+}
286
+
194
 function PlayersManager()
287
 function PlayersManager()
195
 {
288
 {
196
   var _players = new Array();
289
   var _players = new Array();

+ 32 - 32
web/jplayer/skin/blue.monday/jplayer.blue.monday.css View File

153
 }
153
 }
154
 
154
 
155
 a.jp-play {
155
 a.jp-play {
156
-	background: url("jplayer.blue.monday.jpg") 0 0 no-repeat;
156
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 0 no-repeat;
157
 }
157
 }
158
 a.jp-play:hover {
158
 a.jp-play:hover {
159
-	background: url("jplayer.blue.monday.jpg") -41px 0 no-repeat;
159
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -41px 0 no-repeat;
160
 }
160
 }
161
 a.jp-pause {
161
 a.jp-pause {
162
-	background: url("jplayer.blue.monday.jpg") 0 -42px no-repeat;
162
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -42px no-repeat;
163
 	display: none;
163
 	display: none;
164
 }
164
 }
165
 a.jp-pause:hover {
165
 a.jp-pause:hover {
166
-	background: url("jplayer.blue.monday.jpg") -41px -42px no-repeat;
166
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -41px -42px no-repeat;
167
 }
167
 }
168
 
168
 
169
 a.jp-stop, a.jp-previous, a.jp-next {
169
 a.jp-stop, a.jp-previous, a.jp-next {
173
 }
173
 }
174
 
174
 
175
 a.jp-stop {
175
 a.jp-stop {
176
-	background: url("jplayer.blue.monday.jpg") 0 -83px no-repeat;
176
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -83px no-repeat;
177
 	margin-left:10px;
177
 	margin-left:10px;
178
 }
178
 }
179
 
179
 
180
 a.jp-stop:hover {
180
 a.jp-stop:hover {
181
-	background: url("jplayer.blue.monday.jpg") -29px -83px no-repeat;
181
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -29px -83px no-repeat;
182
 }
182
 }
183
 
183
 
184
 a.jp-previous {
184
 a.jp-previous {
185
-	background: url("jplayer.blue.monday.jpg") 0 -112px no-repeat;
185
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -112px no-repeat;
186
 }
186
 }
187
 a.jp-previous:hover {
187
 a.jp-previous:hover {
188
-	background: url("jplayer.blue.monday.jpg") -29px -112px no-repeat;
188
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -29px -112px no-repeat;
189
 }
189
 }
190
 
190
 
191
 a.jp-next {
191
 a.jp-next {
192
-	background: url("jplayer.blue.monday.jpg") 0 -141px no-repeat;
192
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -141px no-repeat;
193
 }
193
 }
194
 a.jp-next:hover {
194
 a.jp-next:hover {
195
-	background: url("jplayer.blue.monday.jpg") -29px -141px no-repeat;
195
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -29px -141px no-repeat;
196
 }
196
 }
197
 
197
 
198
 /* @end */
198
 /* @end */
223
 	height:10px;
223
 	height:10px;
224
 }
224
 }
225
 div.jp-seek-bar {
225
 div.jp-seek-bar {
226
-	background: url("jplayer.blue.monday.jpg") 0 -202px repeat-x;
226
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -202px repeat-x;
227
 	width:0px;
227
 	width:0px;
228
 	height:100%;
228
 	height:100%;
229
 	cursor: pointer;
229
 	cursor: pointer;
230
 }
230
 }
231
 div.jp-play-bar {
231
 div.jp-play-bar {
232
-	background: url("jplayer.blue.monday.jpg") 0 -218px repeat-x ;
232
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -218px repeat-x ;
233
 	width:0px;
233
 	width:0px;
234
 	height:100%;
234
 	height:100%;
235
 }
235
 }
289
 }
289
 }
290
 
290
 
291
 a.jp-mute {
291
 a.jp-mute {
292
-	background: url("jplayer.blue.monday.jpg") 0 -170px no-repeat;
292
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -170px no-repeat;
293
 }
293
 }
294
 a.jp-mute:hover {
294
 a.jp-mute:hover {
295
-	background: url("jplayer.blue.monday.jpg") -19px -170px no-repeat;
295
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -19px -170px no-repeat;
296
 }
296
 }
297
 a.jp-unmute {
297
 a.jp-unmute {
298
-	background: url("jplayer.blue.monday.jpg") -60px -170px no-repeat;
298
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -60px -170px no-repeat;
299
 	display: none;
299
 	display: none;
300
 }
300
 }
301
 a.jp-unmute:hover {
301
 a.jp-unmute:hover {
302
-	background: url("jplayer.blue.monday.jpg") -79px -170px no-repeat;
302
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -79px -170px no-repeat;
303
 }
303
 }
304
 a.jp-volume-max {
304
 a.jp-volume-max {
305
-	background: url("jplayer.blue.monday.jpg") 0 -186px no-repeat;
305
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -186px no-repeat;
306
 }
306
 }
307
 a.jp-volume-max:hover {
307
 a.jp-volume-max:hover {
308
-	background: url("jplayer.blue.monday.jpg") -19px -186px no-repeat;
308
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -19px -186px no-repeat;
309
 }
309
 }
310
 
310
 
311
 div.jp-volume-bar {
311
 div.jp-volume-bar {
312
 	position: absolute;
312
 	position: absolute;
313
 	overflow:hidden;
313
 	overflow:hidden;
314
-	background: url("jplayer.blue.monday.jpg") 0 -250px repeat-x;
314
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -250px repeat-x;
315
 	width:46px;
315
 	width:46px;
316
 	height:5px;
316
 	height:5px;
317
 	cursor: pointer;
317
 	cursor: pointer;
329
 	left:72px;
329
 	left:72px;
330
 }
330
 }
331
 div.jp-volume-bar-value {
331
 div.jp-volume-bar-value {
332
-	background: url("jplayer.blue.monday.jpg") 0 -256px repeat-x;
332
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -256px repeat-x;
333
 	width:0px;
333
 	width:0px;
334
 	height:5px;
334
 	height:5px;
335
 }
335
 }
561
 }
561
 }
562
 
562
 
563
 a.jp-full-screen {
563
 a.jp-full-screen {
564
-	background: url("jplayer.blue.monday.jpg") 0 -310px no-repeat;
564
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -310px no-repeat;
565
 	margin-left: 20px;
565
 	margin-left: 20px;
566
 }
566
 }
567
 
567
 
568
 a.jp-full-screen:hover {
568
 a.jp-full-screen:hover {
569
-	background: url("jplayer.blue.monday.jpg") -30px -310px no-repeat;
569
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -30px -310px no-repeat;
570
 }
570
 }
571
 
571
 
572
 a.jp-restore-screen {
572
 a.jp-restore-screen {
573
-	background: url("jplayer.blue.monday.jpg") -60px -310px no-repeat;
573
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -60px -310px no-repeat;
574
 	margin-left: 20px;
574
 	margin-left: 20px;
575
 }
575
 }
576
 
576
 
577
 a.jp-restore-screen:hover {
577
 a.jp-restore-screen:hover {
578
-	background: url("jplayer.blue.monday.jpg") -90px -310px no-repeat;
578
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -90px -310px no-repeat;
579
 }
579
 }
580
 
580
 
581
 a.jp-repeat {
581
 a.jp-repeat {
582
-	background: url("jplayer.blue.monday.jpg") 0 -290px no-repeat;
582
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -290px no-repeat;
583
 }
583
 }
584
 
584
 
585
 a.jp-repeat:hover {
585
 a.jp-repeat:hover {
586
-	background: url("jplayer.blue.monday.jpg") -30px -290px no-repeat;
586
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -30px -290px no-repeat;
587
 }
587
 }
588
 
588
 
589
 a.jp-repeat-off {
589
 a.jp-repeat-off {
590
-	background: url("jplayer.blue.monday.jpg") -60px -290px no-repeat;
590
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -60px -290px no-repeat;
591
 }
591
 }
592
 
592
 
593
 a.jp-repeat-off:hover {
593
 a.jp-repeat-off:hover {
594
-	background: url("jplayer.blue.monday.jpg") -90px -290px no-repeat;
594
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -90px -290px no-repeat;
595
 }
595
 }
596
 
596
 
597
 a.jp-shuffle {
597
 a.jp-shuffle {
598
-	background: url("jplayer.blue.monday.jpg") 0 -270px no-repeat;
598
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") 0 -270px no-repeat;
599
 	margin-left: 5px;
599
 	margin-left: 5px;
600
 }
600
 }
601
 
601
 
602
 a.jp-shuffle:hover {
602
 a.jp-shuffle:hover {
603
-	background: url("jplayer.blue.monday.jpg") -30px -270px no-repeat;
603
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -30px -270px no-repeat;
604
 }
604
 }
605
 
605
 
606
 a.jp-shuffle-off {
606
 a.jp-shuffle-off {
607
-	background: url("jplayer.blue.monday.jpg") -60px -270px no-repeat;
607
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -60px -270px no-repeat;
608
 	margin-left: 5px;
608
 	margin-left: 5px;
609
 }
609
 }
610
 
610
 
611
 a.jp-shuffle-off:hover {
611
 a.jp-shuffle-off:hover {
612
-	background: url("jplayer.blue.monday.jpg") -90px -270px no-repeat;
612
+	background: url("/jplayer/skin/blue.monday/jplayer.blue.monday.jpg") -90px -270px no-repeat;
613
 }
613
 }
614
 
614
 
615
 
615