0

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)

1 Answers1

0

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:

Powershell.exe cd 'C:\Program Files\VideoLAN\VLC\';./vlc.exe --loop -Z --global-key-clear-playlist='CTRL+W' --one-instance --directx-device="DISPLAY1" --directx-volume=1.00 '"Path\To\Your\Playlist\playlist.m3u'"

Once VLC has started this way, send over a key stroke for example, through PowerShell, to press the key. Example command:

powershell.exe $wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{w}');

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:

  1. Clear Playlist --> Open program action. (the rocket)
  2. Add playlist. --> Open program action. (the rocket)

For the first action I have the following command in the App / file section:

powershell.exe $wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{w}');

--> 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:

Powershell.exe cd 'C:\Program Files\VideoLAN\VLC\';./vlc.exe --loop -Z --global-key-clear-playlist='CTRL+W' --one-instance --directx-device="DISPLAY1" --directx-volume=1.00 '"Path\To\Your\Playlist\playlist.m3u'"

--> 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:

Activating the Web Interface To activate the web interface, click the Tools menu in VLC and select Preferences. Click the All option under Show settings to view VLC’s advanced settings. Scroll down in the list of advanced settings and select Main interfaces under the Interface header. Click the Web checkbox to enable the HTTP interface. Click on LUA under the Main interfaces. Set a password under the LUA-HTTP settings. Save your settings and restart VLC. Each time you start VLC, the web server will be started in the background – Windows will prompt you to allow VLC firewall access when you restart it, indicating that the web server is running.

Configuring Stream Deck VLC Control In your stream deck configuration manager, add a VLC Control button. Click on this button, and set the following parameters, replacing password with the password you previously set. Host: localhost Port: 8080 Password: {PASSWORD SET IN VLC} This is to have an extra plugin installed https://github.com/RGPaul/streamdeck-vlc --> This will enable you to stop and start your music on the stream deck. (you can find it on the product page inside of the stream deck application) However it is not necessary for clearing the playlist.