2014-03-26 31 views

回答

0

BackgroundAudioPlayer只能播放獨立存儲或遠程URI中的文件。您需要做的就是將音軌列表作爲播放器的播放列表。

這些只是根據您的需要修改的示例示例。

//獲取uri使用文件的IsolatedStorageFileStream Name屬性進行跟蹤。 reference

private static string GetAbsolutePath(string filename) 
    { 
     IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication(); 

     string absoulutePath = null; 

     if (isoStore.FileExists(filename)) 
     { 
      IsolatedStorageFileStream output = new IsolatedStorageFileStream(filename, FileMode.Open, isoStore); 
      absoulutePath = output.Name; 

      output.Close(); 
      output = null; 
     } 

     return absoulutePath; 
    } 

    //now instantiate list of audio track with the uri to track 
    List<AudioTrack> = new List<AudioTrack> 
    { 
     new AudioTrack(new Uri("URI TO FILE IN ISOLATED STORAGE", UriKind.Relative), 
       "title", 
       "artist", 
       "album", 
       "Uri To albumArt or null"), 

     new AudioTrack(new Uri("URI TO FILE IN ISOLATED STORAGE", UriKind.Relative), 
       "title", 
       "artist", 
       "album", 
       "Uri To albumArt or null") 
    }; 

對於進一步閱讀:http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202978(v=vs.105).aspx

相關問題