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