❔ How can I control the media playing on my computer using .NET?
I want to control the currently playing music in my computer using C#, I tried using ChatGPT to give me an idea, and had no luck.
Any help will be appriciated.
12 Replies
what do you mean by controlling the currently playing music
you mean, like, music that is being played by other applications?
Yes
(Sorry for the delay, I wasn't home)
I want to control youtube music on my laptop through my phone
there are two hard parts to this. one of them is getting your phone to talk to the computer. the other one is getting the computer to control the music
both are entirely separate problems, you can find solutions to them independently and sort of just 'hook them up'
controlling the music is actually pretty easy. you would use https://learn.microsoft.com/en-us/uwp/api/windows.media.control.globalsystemmediatransportcontrolssessionmanager?view=winrt-22621
GlobalSystemMediaTransportControlsSessionManager Class (Windows.Med...
Provides access to playback sessions throughout the system that have integrated with SystemMediaTransportControls to provide playback info and allow remote control.
i think the API is pretty self-explanatory
the other part is probably the harder one, you need some kind of server running on your PC and a phone app that can send requests like "pause" "play" "change volume" etc. to that server
my first thought is to use ASP.NET to make a simple web API, and you write a phone app that can call it. or even just a website that you can connect to from a web browser
(you would probably want to keep that server on your local network, not the internet, unless you care to implement authorization of some sort)
Getting my phone to communicate with my computer is not a problem, I'm gonna use websockets and the c# program is going to run as a service in the background, my problem is control the media in the computer using C#
or even simpler, HttpListener
Is there a way to use this through a console app?
instead of UWP
sorry if it's a dumb question, I'm new to C#
in your project properties, you want to set these
here it is reading my youtube information
I will try this
God bless you man
wishing you the best
For real
I haven't found a soulution and I've been searching for hours
little question
how do you know all of this
projects from the past?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.