//重置音频窗口的图标 public void changeVolumeStatus(bool volumeStatus) { try { if (this.audioPlayedStatus != volumeStatus) { logger.Info("修改窗口[" + _index + "]上的音频状态为:" + volumeStatus); } this.audioPlayedStatus = volumeStatus; if (volumeStatus) { //PlayerSdk.EasyPlayer_StopSound(); //Thread.Sleep(500); logger.Info("播放音频:" + channelId); int ret = PlayerSdk.EasyPlayer_PlaySound(channelId); logger.Info("播放音频状态:" + ret); volumeSwitch.BackgroundImage = Properties.Resources.redioOpen; } else { PlayerSdk.EasyPlayer_StopSound(); volumeSwitch.BackgroundImage = Properties.Resources.redioClose; } } catch (Exception e) { logger.Error("", e); } }
public void closeRtsp(bool isLeave) { logger.Info("将要关闭窗口[" + key + "]上的流"); try { VideoPlayModel v = messageModel.videoData; if (isLeave) { if (v.isCamera && !messageModel.watchSubordinateLiveMessageBean.isThisPlatform) { mainForm.tcpServerService.notifyHangupVideoChild(v.liveMemberNo, v.isCamera, messageModel.watchSubordinateLiveMessageBean); } else if (v.streamType == "RTSP") { mainForm.tcpServerService.notifyHangupVideo(v); } } //关闭视频 int ret = PlayerSdk.EasyPlayer_CloseStream(channelId); logger.Info("关闭视频是否成功:" + ret); if (ret == 0) { //关闭音频 int audioStatus = PlayerSdk.EasyPlayer_PlaySound(channelId); logger.Info("关闭音频是否成功:" + audioStatus); channelId = 0; videoPlayStatus = false; audioPlayedStatus = false; //关闭后隐藏 onePlayerPanel.Visible = false; titlePanel.Visible = false; comBtnPanel.Visible = false; ptzPanel.Visible = false; //清空保存的播放参数 this.messageModel = null; this.key = ""; //全屏播放窗口关闭后,还原窗口 if (mainForm.checkFullScreenWinByKey(key)) { mainForm.changeFullScreen(null); } } } catch (Exception e) { logger.Error("", e); } }
/// <summary> /// 播放音频 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlaySound_MenuItem_Click(object sender, EventArgs e) { if (channelID <= 0) { return; } var checkState = (sender as ToolStripMenuItem).CheckState; if (checkState == CheckState.Unchecked) { int ret = PlayerSdk.EasyPlayer_PlaySound(channelID); (sender as ToolStripMenuItem).CheckState = CheckState.Checked; } if (checkState == CheckState.Checked) { int ret = PlayerSdk.EasyPlayer_StopSound(); (sender as ToolStripMenuItem).CheckState = CheckState.Unchecked; } }