private void sendPlayCommand(bool isDefaultPlayer) { Environment.SetEnvironmentVariable("SDL_AUDIODRIVER", "directsound", EnvironmentVariableTarget.Process); var exArgs = getExArgs(); if (isDefaultPlayer) { try { var volume = (ctrl != null) ? ((ctrl.volume == -10) ? 0 : ctrl.volume) : int.Parse(config.get("volume")); util.debugWriteLine("kia 00 " + form.rec.hlsUrl); if (form.rec.hlsUrl.StartsWith("http")) { playCommand("ffplay", form.rec.hlsUrl + " -autoexit -volume " + volume + " " + exArgs); } else { // playCommandStd("MPC-HC.1.7.13.x86/mpc-hc.exe", "-"); Task.Run(() => playCommandStd("ffplay.exe", form.rec.hlsUrl + " -autoexit -volume " + volume + " " + exArgs)); } util.debugWriteLine("kia 0 " + ctrl); if (ctrl == null) { ctrl = new defaultFFplayController(config, process, this); form.formAction(() => ctrl.Show(), false); } else { ctrl.process = process; ctrl.reset(); } util.debugWriteLine("kia 1 " + ctrl); } catch (Exception e) { util.debugWriteLine("sendPlayCommand exception " + e.Message + e.Source + e.StackTrace + e.StackTrace + e.TargetSite); } } else { if (form.rec.hlsUrl.StartsWith("http")) { playCommand(config.get("anotherPlayerPath"), form.rec.hlsUrl + " " + exArgs); } else { playCommandStd(config.get("anotherPlayerPath"), form.rec.hlsUrl + " " + exArgs); } } }
private void ctrlFormClose() { if (ctrl == null || ctrl.IsDisposed) { return; } try { ctrl.Invoke((MethodInvoker) delegate() { try { ctrl.Close(); } catch (Exception e) { util.debugWriteLine("ctrl close exception " + e.Message + e.Source + e.StackTrace + e.TargetSite); } }); } catch (Exception ee) { util.debugWriteLine("ctrl close2 exception " + ee.Message + ee.Source + ee.StackTrace + ee.TargetSite); } ctrl = null; }