MediaPlayer will now remember where the user was on restart. Also able to reconnect...
[profile/ivi/MediaPlayer.git] / js / listFunctions.js
index 0b8d45e..2994825 100644 (file)
@@ -141,15 +141,16 @@ function makeListItem(j, k, contentList, playerType, listItems)
                case "AUDIO":
                try
                {
-               audioIndex = $(this).parent().parent().index();
-               loadAndPlay = true;
-               updateMediaName(audioContent[audioIndex].artists[0], audioContent[audioIndex].title, audioContent[audioIndex].coverArt);
-               $("#audioSrc").attr("src", audioContent[audioIndex].contentURI);
-               audioPlayer.load();
+                   audioIndex = $(this).parent().parent().index();
+                   loadAndPlay = true;
+                   updateMediaName(audioContent[audioIndex].artists[0], audioContent[audioIndex].title, audioContent[audioIndex].coverArt);
+                   $("#audioSrc").attr("src", audioContent[audioIndex].contentURI);
+                   localStorage.prevAudioTrack = audioContent[audioIndex].contentURI;
+                   audioPlayer.load();
                }
                catch(err)
                {
-               console.log("MediaPlayer: load audio error " + err.message);
+                       console.log("MediaPlayer: load audio error " + err.message);
                }
                break;
 
@@ -158,6 +159,7 @@ function makeListItem(j, k, contentList, playerType, listItems)
                {
                    videoIndex = $(this).parent().parent().index();
                    $("#videoSrc").attr("src", videoContent[videoIndex].contentURI);
+                   localStorage.prevVideo = videoContent[videoIndex].contentURI;
                    videoPlayer.load();
                    currentMediaList.fadeOut(300);
                }