So i'm having a quite simple problem which doesnt seem to be trivial to solve. I found LibVLCSharp for controlling my videos from my c# program, which is exactly what i wanted. But i find the documentation to be quite complicated or non-existant.
I want to accomplish playing up to 4 different videos on 4 installed Monitors on one windows machine. I had a working example for 2 monitors right here:
string[] vlcParameter1 = new string[]
{
@"--video-x=-1024",
@"--video-y=1",
@"--video-on-top",
@"--fullscreen",
@"--no-one-instance"
};
string[] vlcParameter2 = new string[]
{
@"--video-x=1",
@"--video-y=1",
@"--video-on-top",
@"--fullscreen",
@"--no-one-instance"
};
using var libvlc1 = new LibVLC(enableDebugLogs: true, vlcParameter1);
using var libvlc2 = new LibVLC(enableDebugLogs: true, vlcParameter2);
using var media1 = new Media(libvlc1, new Uri(@"C:\sample.mp4"));
using var media2 = new Media(libvlc1, new Uri(@"C:\sample.mp4"));
using var mediaplayer1 = new MediaPlayer(media1);
using var mediaplayer2 = new MediaPlayer(media2);
mediaplayer1.Fullscreen = false;
mediaplayer2.Fullscreen = false;
mediaplayer1.Play();
mediaplayer2.Play();
Thats pretty simple but the FAQ from the libvlcsharp github page says to NEVER instanciate more than one LibVLC object. Which i'm doing there. Its working fine but i dont know about the problems.
To avoid this, i tried to use the Media.AddOption like this:
media1.AddOption(":video-x=-1024");
media1.AddOption(":video-y=1");
But that didnt work either. Is there another simple way to display multiple videos on multiple screens?