C# 获取存储在独立存储器中的音乐持续时间

C# 获取存储在独立存储器中的音乐持续时间,c#,windows-phone-8,C#,Windows Phone 8,我正在使用MusicProerties获取音乐持续时间,但它抛出异常 StorageFolder localRoot = Windows.Storage.ApplicationData.Current.LocalFolder; StorageFolder mp3 = await localRoot.GetFolderAsync(Path.GetDirectoryName(fileFullPath)); StorageFile file = await mp3.GetFileAsync(Path.

我正在使用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不支持此功能,我很抱歉。

是的,您是对的-此API as尚未实现:

Windows Phone 8

此API未实现,如果调用,将引发异常。请参阅Windows Phone运行时API

AFAIK目前还没有简单的方法从音频文件属性获取持续时间