All Projects → DubyaDude → WindowsMediaController

DubyaDude / WindowsMediaController

Licence: MIT license
Allows developers to more easily get information from and interact with the Windows 10/11 OS media interface.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to WindowsMediaController

Projectreunion
The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
Stars: ✭ 2,612 (+6270.73%)
Mutual labels:  windows-10, windows-11
LRReader
A feature-complete reader and client for LANraragi
Stars: ✭ 62 (+51.22%)
Mutual labels:  windows-10, windows-11
Windows Auto Night Mode
Automatically switches between the dark and light theme of Windows 10 and Windows 11
Stars: ✭ 3,375 (+8131.71%)
Mutual labels:  windows-10, windows-11
DevToys
A Swiss Army knife for developers.
Stars: ✭ 4,986 (+12060.98%)
Mutual labels:  windows-10, windows-11
packer-windows
Windows Templates for Packer: Windows 11, Windows 10, Windows Server 2022, 2019, 2016, also with Docker
Stars: ✭ 1,116 (+2621.95%)
Mutual labels:  windows-10, windows-11
Windows 10 Sophia Script
⚡ The most powerful PowerShell module on GitHub for Windows 10 & Windows 11 fine-tuning and tweaking
Stars: ✭ 4,133 (+9980.49%)
Mutual labels:  windows-10, windows-11
privacy-settings
Guide to privacy settings for most major softwares and services.
Stars: ✭ 97 (+136.59%)
Mutual labels:  windows-10, windows-11
image-customise
Customise a Windows 10/11 or Windows Server image at deployment time, including the default user profile, application packages and OS features
Stars: ✭ 44 (+7.32%)
Mutual labels:  windows-10, windows-11
WindowsAppSDK
The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
Stars: ✭ 3,089 (+7434.15%)
Mutual labels:  windows-10, windows-11
avrdude
AVRDUDE for Windows
Stars: ✭ 83 (+102.44%)
Mutual labels:  windows-10, windows-11
Sophia-Script-for-Windows
⚡ The most powerful PowerShell module on GitHub for Windows 10 & Windows 11 fine-tuning and tweaking
Stars: ✭ 4,311 (+10414.63%)
Mutual labels:  windows-10, windows-11
wor-flasher
Legal utility that runs on RPiOS to flash another SD card with Windows 10/11
Stars: ✭ 451 (+1000%)
Mutual labels:  windows-10, windows-11
Windows.10.DNS.Block.List
Windows DNS Block List
Stars: ✭ 18 (-56.1%)
Mutual labels:  windows-10, windows-11
Files
A modern file manager that pushes the boundaries of the platform.
Stars: ✭ 15,198 (+36968.29%)
Mutual labels:  windows-10, windows-11
keypirinha-winsys
A Keypirinha plugin with useful system and shell commands for Windows 10/11.
Stars: ✭ 34 (-17.07%)
Mutual labels:  windows-10, windows-11
Breadplayer
Bread Player, a free and open source music player powered by UWP and C#/.NET with a sleek and polished design built for, and by, the people seeking a better alternative to Groove and Windows Media Player by Microsoft.
Stars: ✭ 267 (+551.22%)
Mutual labels:  music-player, windows-10
Rise-Media-Player
One media player for everything you own or stream; whether it's music or videos, online or offline Rise Media Player does it all. And it's beautiful and native with the latest version of WinUI.
Stars: ✭ 600 (+1363.41%)
Mutual labels:  windows-10, windows-11
BetterWindows
Some windows tips to improve your UX experience when using windows
Stars: ✭ 27 (-34.15%)
Mutual labels:  windows-10, windows-11
inbox-notifier
Gmail notifications instantly in the Windows taskbar
Stars: ✭ 55 (+34.15%)
Mutual labels:  windows-10, windows-11
MediaFlyout
Windows 10+ Media Control Taskbar Flyout
Stars: ✭ 87 (+112.2%)
Mutual labels:  windows-10, windows-11

Windows Media Controller

NuGet

This repository provides a wrapper for developers to more easily get information from and interact with the Windows 10/11 OS media interface.

Windows 10 Media Interface

This allows for a better understanding and control of the Media Sessions and can have many different applications. Some features include:

  • Control playback on individual Media Sessions (Spotify, Chrome, etc)
  • Get media information of currently playing (Song, Author, Thumbnail, etc)

Requirements

  • Windows 10 (Build 17763+) or Windows 11
  • The ability to talk to Windows Runtime. (In a majority of cases, this will not be an issue)
  • .NET Framework 4.6+ or .NET Core 3.0+ or .NET 5+
  • May need to be able to interact with the desktop
    • In situations such as being run through Windows Task Scheduler, the application will need an active window to start with, you can hide it afterward.

NET Framework:

For .NET Framework, I've seen people encountering issues with how the package gets imported. If you run across this issue, add the package by adding this to the .csproj file.
(replacing '2.1.0' with the preferred NuGet version)

<ItemGroup>
  <PackageReference Include="Dubya.WindowsMediaController">
    <Version>2.1.0</Version>
  </PackageReference>
</ItemGroup>

NET 5+:

NET 5 brought along a lot of changes in how WinRT is meant to be accessed. More of that info can be found here.

If you're doing a GUI app you should be good to go and be able to just import the lib.

However, for other cases, your TargetFramework in the .csproj file needs to be modified before importing the package.
(replacing net5.0 with desired .NET version)

<TargetFramework>net5.0-windows10.0.22000.0</TargetFramework>

How To Use

Initialization:

mediaManager = new MediaManager();

mediaManager.OnAnySessionOpened += MediaManager_OnAnySessionOpened;
mediaManager.OnAnySessionClosed += MediaManager_OnAnySessionClosed;
mediaManager.OnAnyMediaPropertyChanged += MediaManager_OnAnyMediaPropertyChanged;
mediaManager.OnAnyPlaybackStateChanged += MediaManager_OnAnyPlaybackStateChanged;

mediaManager.Start();

Class Structure:

MediaManager:

ReadOnlyDictionary<string, MediaSession> CurrentMediaSessions;
bool IsStarted { get; }
GlobalSystemMediaTransportControlsSessionManager WindowsSessionManager { get; }

delegate void OnAnySessionOpened(MediaManager.MediaSession session);
delegate void OnAnySessionClosed(MediaManager.MediaSession session);
delegate void OnAnyMediaPropertyChanged(MediaManager.MediaSession sender, GlobalSystemMediaTransportControlsSessionMediaProperties args);
delegate void OnAnyPlaybackStateChanged(MediaManager.MediaSession sender, GlobalSystemMediaTransportControlsSessionPlaybackInfo args);

MediaManager.MediaSession:

readonly string Id;
GlobalSystemMediaTransportControlsSession ControlSession { get; }

delegate void OnSessionClosed(MediaManager.MediaSession session);
delegate void OnMediaPropertyChanged(MediaManager.MediaSession sender, GlobalSystemMediaTransportControlsSessionMediaProperties args);
delegate void OnPlaybackStateChanged(MediaManager.MediaSession sender, GlobalSystemMediaTransportControlsSessionPlaybackInfo args);

Getting Some Info:

  • Getting PlaybackInfo (Seeing what actions are available/Is paused or playing, etc)

    • Returns: GlobalSystemMediaTransportControlsSessionPlaybackInfo
    • mediaSession.ControlSession.GetPlaybackInfo()
  • Getting current MediaProperties (Currently playing title, author, thumbnail, etc)

    • Returns: GlobalSystemMediaTransportControlsSessionMediaProperties
    • await mediaSession.ControlSession.TryGetMediaPropertiesAsync()

Useful Microsoft Documentations:

Samples

  • Sample.CMD - A very barebone console application for developers to get a feel of how their use-case might act.

Sample.CMD

  • Sample.UI - A WPF media controller

Sample.UI

Credit

  • Luca Marini (gitlab) - Helped me understand the Windows API
  • Google (materialui) - Utilizing their play icon to create our icon
  • Kinnara (ModernWpf) - Utilized the ModernWpf library to create the UI sample
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].