[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bowncloud/media=5Fplayer=5D_apps/media/js=3A_properl?=
From:       Robin Appelman <icewind1991 () gmail ! com>
Date:       2011-06-01 0:29:45
Message-ID: 20110601002945.AE349A60A4 () git ! kde ! org
[Download RAW message or body]

Git commit fa7b1d1c5bc274562e610b8d8088d52eb62f423d by Robin Appelman.
Committed on 01/06/2011 at 02:28.
Pushed by rappelman into branch 'media_player'.

properly use flash fallback when the browser doesn't provide html5 playback for all \
files

M  +22   -5    apps/media/js/music.js     

http://commits.kde.org/owncloud/fa7b1d1c5bc274562e610b8d8088d52eb62f423d

diff --git a/apps/media/js/music.js b/apps/media/js/music.js
index acf896c..af7d93c 100644
--- a/apps/media/js/music.js
+++ b/apps/media/js/music.js
@@ -108,14 +108,32 @@ $(document).ready(function() {
 				this.playlistConfig(this.current);
 			}
 		},
-		playlistConfig: function(index) {
+		playlistConfig: function(index,play) {
 			$(this.cssSelector.playlist + "_item_" + \
this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current");
  $(this.cssSelector.playlist + "_item_" + \
index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current");  \
                this.current = index;
-			$(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
+			var that=this;
+			if(this.playlist[this.current]){
+				if($(this.cssSelector.jPlayer).data('jPlayer').options.supplied!=this.playlist[this.current].type){//the \
the audio type changes we need to reinitialize jplayer \
+					$(this.cssSelector.jPlayer).jPlayer("destroy"); \
+					$(this.cssSelector.jPlayer).jPlayer({ +						ended:this.options.ended,
+						play:this.options.play,
+						supplied:this.playlist[this.current].type,
+						ready:function(){
+							that.playlistConfig(index);
+							if(play){
+								$(that.cssSelector.jPlayer).jPlayer("play");
+							}
+						}
+					});
+				}else{
+					$(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
+				}
+			}
 		},
 		playlistChange: function(index) {
-			this.playlistConfig(index);
+			this.playlistConfig(index,true);
 			$(this.cssSelector.jPlayer).jPlayer("play");
 		},
 		playlistNext: function() {
@@ -153,7 +171,7 @@ $(document).ready(function() {
 			if(stuff.song_name){
 				var extention=stuff.song_path.split('.').pop();
 				var type=musicTypeFromExtention(extention);
-				var item={name:stuff.song_name};
+				var item={name:stuff.song_name,type:type};
 				item[type]=URLBASE+stuff.song_path;
 				this.playlist.push(item);
 			}
@@ -224,7 +242,6 @@ $(document).ready(function() {
 				play: function() {
 					$(this).jPlayer("pauseOthers");
 				},
-				supplied: types.join(', ')
 			});
 		}
 	});


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic