private void InitializeSetup() { msStatus.ServerStatus = STATUS.Stop; labServerStatus.Text = "已停止"; comTimeMinute.SelectedIndex = 2; msSettings.IsCycle = radDeleteYes.Checked; msSettings.Directory = ""; msSettings.Duration = readTime(); options = new string[1]; options[0] = ":rtsp-caching=300"; /**options[1] = ":ttl=12"; * options[2] = ":rtp-caching=300"; */ UISync.Init(this); this.toolDeleteAll.Click += toolDeleteAll_Click; this.toolDeleteSel.Click += toolDeleteSel_Click; mediaTimer = new System.Timers.Timer(); mediaTimer.AutoReset = true; mediaTimer.Elapsed += mediaTimer_Elapsed; mediaTimer.Enabled = false; //初始化操作监听类 osListener = new OperationServer(100, 2000, ""); //osListener.Start(8556); //LinkNumTimer.Start(); //checkDiskEnough() }
void Events_MediaInstanceError(object sender, Declarations.VLM.VlmEvent e) { UISync.Execute(() => labStatus.Text = "组播失败 "); showMessage("组播出错,请检查URL各个设备时候能正常访问"); UISync.Execute(() => btnStop.PerformClick()); //showMessage(e.ToString()); /** if (msStatus.ServerStatus == STATUS.Running) msStatus.ServerStatus = STATUS.Stop; * UISync.Execute(() => btnStart.Enabled = true); * UISync.Execute(() => btnStop.Enabled = false); * UISync.Execute(() => groupAdd.Enabled = true); * UISync.Execute(() => groupSetup.Enabled = true);*/ }
/// <summary> /// 时钟TICK函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mediaTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { //如果是第一次进入 if (msStatus.ServerStatus == STATUS.Stop) { this.msStatus.ServerStatus = STATUS.Running; mediaTimer.Interval = msSettings.Duration * 1000; } //检查当前盘符时候够用 while (!checkDiskEnough()) { if (msSettings.IsCycle) { //删除以前的文件 deleteFiles(); } else {//停止服务 UISync.Execute(() => this.btnStop.PerformClick()); return; } } //首先停止所有 foreach (Device device in devices) { m_factory.VideoLanManager.Stop(device.ShortUrl); } //首先设置每个流的output foreach (Device device in devices) { m_factory.VideoLanManager.SetOutput(device.ShortUrl, string.Format(outputStore, msSettings.Directory, device.ShortUrl + "_" + DateTime.Now.ToString("yyyyMMddHHmmss")).Replace("<", "{").Replace(">", "}")); } //UISync.Execute(() => labServerStatus.Text = "运行中" + DateTime.Now.ToLongTimeString()); //if (msStatus.ServerStatus == STATUS.Stop) { //重新启动 foreach (Device device in devices) { m_factory.VideoLanManager.Play(device.ShortUrl); } UISync.Execute(() => labServerStatus.Text = "运行中" + DateTime.Now.ToLongTimeString()); }
private void LinkNumTimer_Tick(object sender, EventArgs e) { //if (msStatus.ServerStatus == STATUS.Running) { UISync.Execute(() => labLinkNum.Text = osListener.NumberOfConnections.ToString()); //} }
void Events_MediaInstancePlaying(object sender, Declarations.VLM.VlmEvent e) { UISync.Execute(() => labStatus.Text = "组播完成"); }
void Events_MediaInstanceStopped(object sender, Declarations.VLM.VlmEvent e) { UISync.Execute(() => labStatus.Text = "组播停止"); }