2014-02-07 37 views
1

我正在使用MusicProerties獲取音樂持續時間,但它會引發異常。獲取存儲在獨立存儲中的音樂時間

StorageFolder localRoot = Windows.Storage.ApplicationData.Current.LocalFolder; 
StorageFolder mp3 = await localRoot.GetFolderAsync(Path.GetDirectoryName(fileFullPath)); 
StorageFile file = await mp3.GetFileAsync(Path.GetFileName(fileFullPath)); 
Windows.Storage.FileProperties.MusicProperties music = await file.Properties.GetMusicPropertiesAsync(); //Exception is thrown here 

double duration = music.Duration.TotalSeconds; 

唯一的例外是:

{System.NotSupportedException: Specified method is not supported. 
    at Windows.Storage.StorageFile.get_Properties() 

恐怕如果這不是在Windows Phone支持8

回答

0

是你是正確的 - 這是API MSDN says尚未實現:

Windows Phone 8

此API未實現,如果調用將引發異常。請參閱Windows Phone運行時API。

據我所知,現在有沒有簡單的方法,從音頻文件的屬性得到持續,