Florian, here's my latest version. It
should do what you want (Show randomly selected silent video clips over the music video clips whenever the mAirList text file has "true" at the end. It will also choose other random clips if the current one ends before the music video ends.).
Here are instructions and the new script.
Create four scenes, with names something like:
SCENE A
SCENE B
SCENE AR
SCENE BR
In SCENE A, add a Browser Source, with a name like MV A with the following parameters:
Uncheck "Local file"
Set "Width" and "Height" to your OBS base canvas size
Uncheck "Use custom frame rate"
Check "Control audio via OBS"
In "Custom CSS" type:
video::-webkit-media-controls {
display:none;
}
Uncheck "Shutdown source when not visible"
Uncheck "Refresh browser when scene becomes active"
Leave remaining settings at default
In SCENE B, add a Browser Source, with a name like MV B with the same parameters.
In SCENE AR, add a browser source and select "Add Existing" and choose MV A.
Add a Media Source with a name like Random A with the following parameters:
Check "Local File"
Navigate to the folder where your random videos are and select one.
Uncheck "Loop"
Check "Restart playback when source becaomes active"
Check "Use hardware decoding when available"
Uncheck "Show nothing when playback ends"
Uncheck "Close file when inactive"
Leave other settings at default.
After clicking "OK" for the settings, you should now size the source window so it matches your OBS base canvas size.
(Note, all your random videos will need to be the same resolution)
Add another Media Source to SCENE AR with a name like Random B, using the same parameters.
Make sure the order of the sources, from top to bottom, is Random A, Random B then MV A.
Turn off Random A and Random B
In SCENE BR, add a Browser Source and select "Add Existing" and choose MV B.
Add a Media Source and select "Add Existing" and choose Random A.
Add another Media Source, selecting "Add Existing" and choose Random B.
Make sure the order of the sources, from top to bottom, is Random A, Random B then MV A.
Turn off Random A and Random B
Go to the OBS Scripts tool and unload the current "MediaFromTXT4.lua" from the list.
Add "MediaFromTXT5.lua".
In "mAirList txt File" browse to and select the mAirList text file.
In "Random video folder", browse to and select the folder where your random videos are stored.
In the "Scene A" dropdown, select your SCENE A scene.
In the "Scene A Source" dropdown, select your MV A source.
In "Scene B" select your SCENE B scene.
In "Scene B Source" select your MV B source.
In "Random Scene A" select your "SCENE AR" scene.
In "Random Scene B" select your "SCENE BR" scene.
In "Random A Source" select your "Random A" source.
In "Random B Source" select your "Random B" source.
Check "Enable script".
Close OBS and re-start it.
It should start working.