我正在使用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 :(得分:0)
是的,你是对的 - 这个API MSDN says尚未实现:
Windows Phone 8
此API未实现,如果调用则会抛出异常。请参阅Windows Phone Runtime API。
AFAIK现在没有简单的方法来从音频文件属性中获取持续时间,