I have found the answer myself but I am documenting this for myself in the future or for other fellow content creators in case if I would ever forget it.
What I would like to achieve in the grand scheme of things is to play music that is locally stored on my computer on stream. I want the ability to change moods based on a button that is configured on my stream deck. Currently no plugins in the stream deck allow this (I do not count Spotify) so I am going custom.
The best tool for the job is VLC. They have a command line that can be used. I have considered things like media player or groove music but there is no support.
What I need to do is:
- Open VLC
- Add my specific playlist to the player
- Whenever I click another button on my stream deck, clear the playlist, add that specific playlist.
VLC command line is documented here: https://wiki.videolan.org/VLC_command-line_help/
Do a CTRL+F on that page for the word: "Clear" and you will find there is no command for clearing a playlist that is currently playing.
How did I solve this? --> Powershell. (see answer below)
THE ANSWER:
You need to configure a global key that can be pressed anywhere to clear the playlist. This enables you to clear a playlist without being focused in the VLC window. This setting is configured during the startup of VLC. Then send a key stroke of the key you just configured. This is done by adding the following attribute: --global-key-clear-playlist='CTRL+W' You can choose your own keys to your liking by changing CTRL+W to what you desire.
Example command:
Once VLC has started this way, send over a key stroke for example, through PowerShell, to press the key. Example command:
If you want to send over other kind of keys, check out the following stack overflow article: How to send CTRL or ALT + any other key? OR the official documentation: https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-powershell-1.0/ff731008(v=technet.10)?redirectedfrom=MSDN
The ';' means end the current code line and start a new line. Then read that line and execute what is written. This can be used to write down multiple commands that have to be executed in PowerShell even though you can only write down one line of text in your solution. (mine being the stream deck)
If you are a streamer or youtuber using the stream deck, keep reading. Otherwise above is the answer and you can adapt it to your needs with the above logic.
STEP BY STEP GUIDE IF YOU ARE A STREAM DECK USER:
I have my stream deck configured with the following commands: a multi action button. Inside the multi action button I have 2 tasks:
For the first action I have the following command in the App / file section:
--> This will send over the key stroke CTRL + W. In case you don't have anything open or you have not started VLC yet because this is your first press, this has no effect.
The second action is adding the playlist to VLC. This is done with the following command:
--> This command will navigate to the directory where VLC is installed. It will then open vlc with the attributes:
--loop --> Loop all music without stopping
-Z --> Randomize every play and next play
--global-key-clear-playlist --> The key stroke that can be pressed, no matter what window you are focused in
--one-instance --> Only one instance of VLC can run at a time, forcing every vlc.exe command to go to the same instance
--directx-device="DISPLAY1" --> My display where I want VLC to appear. You can find this under the settings: Tools > Preferences > Video > Full screen
-volume=1.00 --> The volume that will be used.
HOW TO ROUTE AUDIO TO A SPECIFIC AUDIO DEVICE IN VLC For some people that have a GO-XLR or any special device they want to route their music to, open up the GUI of VLC first, navigate to: Tools > Preferences > Audio Change the device you want VLC to output to. I have tried forcing it through windows 10 settings but it did not seem to work every time I restarted the computer.
If you are a stream deck user: First of all, enable remote control of VLC. You do this by doing the following: