Skip to content

Commit

Permalink
Application name is now sent with other info
Browse files Browse the repository at this point in the history
  • Loading branch information
Keepoccino committed Aug 21, 2021
1 parent 42c0a9c commit 4aa4336
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MediaKeySyncServer/MediaControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public async Task init()
var gsmtcsm = await GetSystemMediaTransportControlsSessionManager();
session = gsmtcsm.GetCurrentSession();
session.MediaPropertiesChanged += Session_MediaPropertiesChanged;
Console.WriteLine("Controlling " + session.SourceAppUserModelId);
}

private async void Session_MediaPropertiesChanged(GlobalSystemMediaTransportControlsSession sender, MediaPropertiesChangedEventArgs args)
Expand Down Expand Up @@ -58,7 +59,7 @@ public async void Next()

public async Task<MediaProperties> Info()
{
return new MediaProperties(await GetMediaProperties(session));
return new MediaProperties(await GetMediaProperties(session), session.SourceAppUserModelId);
}

private static async Task<GlobalSystemMediaTransportControlsSessionManager> GetSystemMediaTransportControlsSessionManager() =>
Expand Down
4 changes: 3 additions & 1 deletion MediaKeySyncServer/MediaProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public class MediaProperties
{
public string title { get; private set; }
public string artist { get; private set; }
public string app { get; private set; }
public string thumbnailBase64Png { get; private set; }

public MediaProperties(GlobalSystemMediaTransportControlsSessionMediaProperties properties)
public MediaProperties(GlobalSystemMediaTransportControlsSessionMediaProperties properties, string appName)
{
title = properties.Title;
artist = properties.Artist;
app = appName;
Task.Run(async () => thumbnailBase64Png = await convertThumbnailToBase64(properties.Thumbnail)).Wait();
}

Expand Down

0 comments on commit 4aa4336

Please sign in to comment.