summaryrefslogtreecommitdiffstats
path: root/apps/media
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-08-03 14:23:35 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-08-03 14:23:35 +0200
commit8e5184a8b9764acd540062e58a69ab02031e3f21 (patch)
treeab766709e3b3b1814efbb22ccafbeae3b46bc550 /apps/media
parenta84b00cefc6abda9f153b894b1d4ad74b780b058 (diff)
downloadnextcloud-server-8e5184a8b9764acd540062e58a69ab02031e3f21.tar.gz
nextcloud-server-8e5184a8b9764acd540062e58a69ab02031e3f21.zip
correctly save the playlist if songs are removed and dont load the player outisde the media app if the playlist is empty
Diffstat (limited to 'apps/media')
-rw-r--r--apps/media/js/loader.js2
-rw-r--r--apps/media/js/player.js35
-rw-r--r--apps/media/js/playlist.js1
3 files changed, 21 insertions, 17 deletions
diff --git a/apps/media/js/loader.js b/apps/media/js/loader.js
index 429ef742d1a..5fc8a7bce40 100644
--- a/apps/media/js/loader.js
+++ b/apps/media/js/loader.js
@@ -51,7 +51,7 @@ $(document).ready(function() {
}
if(typeof PlayList==='undefined'){
if(typeof localStorage !== 'undefined'){
- if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){
+ if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items' && localStorage.getItem(oc_current_user+'oc_playlist_items')!='[]'){
loadPlayer();
}
}
diff --git a/apps/media/js/player.js b/apps/media/js/player.js
index b6d3bc01ddb..6d585e6e094 100644
--- a/apps/media/js/player.js
+++ b/apps/media/js/player.js
@@ -142,6 +142,7 @@ var PlayList={
remove:function(index){
PlayList.items.splice(index,1);
PlayList.render();
+ PlayList.save();
},
render:function(){},
playing:function(){
@@ -160,24 +161,26 @@ var PlayList={
if(typeof localStorage !== 'undefined'){
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){
PlayList.items=JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_items'));
- PlayList.current=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_current'));
- var time=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_time'));
- if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_volume')){
- var volume=localStorage.getItem(oc_current_user+'oc_playlist_volume');
- PlayList.volume=volume/100;
- $('.jp-volume-bar-value').css('width',volume+'%');
- if(PlayList.player.data('jPlayer')){
- PlayList.player.jPlayer("option",'volume',volume/100);
+ if(PlayList.items.length>0){
+ PlayList.current=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_current'));
+ var time=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_time'));
+ if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_volume')){
+ var volume=localStorage.getItem(oc_current_user+'oc_playlist_volume');
+ PlayList.volume=volume/100;
+ $('.jp-volume-bar-value').css('width',volume+'%');
+ if(PlayList.player.data('jPlayer')){
+ PlayList.player.jPlayer("option",'volume',volume/100);
+ }
}
+ if(JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_playing'))){
+ PlayList.play(null,time);
+ }else{
+ PlayList.play(null,time,function(){
+ PlayList.player.jPlayer("pause");
+ });
+ }
+ PlayList.render();
}
- if(JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_playing'))){
- PlayList.play(null,time);
- }else{
- PlayList.play(null,time,function(){
- PlayList.player.jPlayer("pause");
- });
- }
- PlayList.render();
}
}
}
diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js
index 54fe5b792e7..a15c34f93f9 100644
--- a/apps/media/js/playlist.js
+++ b/apps/media/js/playlist.js
@@ -135,6 +135,7 @@ function procesSelection(){
});
PlayList.items=PlayList.items.filter(function(item){return item!==null});
PlayList.render();
+ PlayList.save();
procesSelection();
});
}