private void PlayVideo(string fileName)
{
if (this.videoPlaying)
{
this.log.Warn("Already playing a video");
return;
}
this.log.Info("Play video {0}", fileName);
var processStart = new ProcessStartInfo
{
FileName = "/usr/bin/omxplayer",
Arguments = "-o local -w -b -z --no-osd --no-keys " + Path.Combine(this.videoPath, fileName),
CreateNoWindow = false,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
};
this.videoPlaying = true;
var process = Process.Start(processStart);
process.EnableRaisingEvents = true;
process.Exited += (o, e) =>
{
this.videoPlaying = false;
this.log.Info("Done playing video");
SendMessage(new VideoFinished
{
Id = fileName
});
process.Dispose();
};
/*
this.log.Warn("1");
var bus = DBus.Bus.System;
this.log.Warn("1.5");
this.log.Warn("2 {0}", bus.UniqueName);
var objPath = new DBus.ObjectPath("/org/mpris/MediaPlayer2");
this.log.Warn("3");
var dbusConnection = bus.GetObject<ITest>("org.mpris.MediaPlayer2.omxplayer", objPath);
this.log.Warn("4");
Thread.Sleep(5000);
dbusConnection.Quit();
bus.Close();*/
}