Windows 10에서 음악을 재생할 때 표시되는 메타 데이터를 쿼리 할 수 있습니까?Windows 10 'Now Playing'카드에서 현재 재생중인 노래
내가 SMTC 등이있는 MediaPlayer
에서 메타 데이터를 표시하는 방법에 대한 정보를 찾을 수 있지만, 나는 단순히 사실을 읽어 (미디어 자체를 재생하지 않습니다) 프로세스에 대한 모든 방법을 찾을 수 없습니다 동일한 메타 데이터.
Windows 10에서 음악을 재생할 때 표시되는 메타 데이터를 쿼리 할 수 있습니까?Windows 10 'Now Playing'카드에서 현재 재생중인 노래
내가 SMTC 등이있는 MediaPlayer
에서 메타 데이터를 표시하는 방법에 대한 정보를 찾을 수 있지만, 나는 단순히 사실을 읽어 (미디어 자체를 재생하지 않습니다) 프로세스에 대한 모든 방법을 찾을 수 없습니다 동일한 메타 데이터.
MusicProperties
클래스는 항목 (파일 또는 폴더와 같은)의 음악 관련 속성에 대한 액세스를 제공합니다.
제목, 앨범, 시간대 등 GetMusicPropertiesAsync()
방법으로 음악 속성을 얻을 수 있습니다. 다음은 자세한 과정입니다.
try
{
FileOpenPicker picker = new FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.MusicLibrary;
picker.FileTypeFilter.Add(".mp3");
var file = await picker.PickSingleFileAsync();
if (file != null)
{
StringBuilder outputText = new StringBuilder();
MusicProperties musicProperties = await file.Properties.GetMusicPropertiesAsync();
outputText.AppendLine("Album: " + musicProperties.Album);
outputText.AppendLine("Rating: " + musicProperties.Rating);
outputText.AppendLine("Title: " + musicProperties.Title);
outputText.AppendLine("TimeSpan: " + musicProperties.Duration.ToString());
MusicTextFiled.Text = outputText.ToString();
}
}
catch (FileNotFoundException)
{
}
내가 현재 제공하고있는 API가 없기 때문에 현재로서는 불가능합니다.
Spotify 나 Groove Music Pass와 같은 음악이 재생되는 경우에는이 기능이 작동하지 않습니다. 이는 내가 주로 읽고 싶었던 부분입니다. – egonny
uwp 응용 프로그램을 개발합니까? –
UWP에 대한 경험이 없지만 문제를 해결하기위한 플랫폼으로 간주하므로 UWP로 태그를 지정했습니다. – egonny