2014-03-26 27 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

相关问题