private void CommandStop() { if (log) { View.Log("CommandStop"); } if (_badPlayer == null) { return; } _badPlayer.Stop(); if (_goodPlayer != null) { if (_shownPlayer == _goodPlayer) { _badPlayer.Volume = _goodPlayer.Volume; } _goodPlayer.Stop(); } _shownPlayer = null; View.SwitchToGoodTimerEnabled = false; View.SwitchToBadTimerEnabled = false; View.StopBadTimerEnabled = false; View.StopGoodTimerEnabled = false; View.StopOnInvisibleTimerEnabled = false; View.HidePlayer = true; _badH = 0; _badW = 0; }
public void CreateBadSource() { _badPlayer = Controller.Get <PlayerPresenter>(); View.SetBadPlayerControl(_badPlayer.Control); _badPlayer.Playing += BadPlaying; _badPlayer.Stopped += BadStopped; _badPlayer.SoundDetected += BadSoundDetected; _badPlayer.Buffering += BadBuffering; _badPlayer.SizeDetected += BadSizeDetected; _badPlayer.LostStream += SignalLostF; _badPlayer.LostStreamRestored += SignalRestoredF; _badPlayer.LostRtspRetryMin = _settings.alert.email.whenDissapearMin; }
private void GoodPlaying() { if (log) { View.Log("GoodPlaying"); } View.HidePlayer = false; _shownPlayer = _goodPlayer; _goodPlayer.Volume = _badPlayer.Volume; _badPlayer.Volume = 0; View.ShowGoodPlayer(); _control.Playing(); View.SwitchToGoodTimerEnabled = false; View.StopGoodTimerEnabled = false; View.StopBadTimerEnabled = true; CheckNeedSwitch(); }
private void ResetSource() { if (log) { View.Log("ResetSource"); } CommandStop(); View.HidePlayer = true; if (_source != null) { _source.position = -1; _source = null; } View.SrcName = ""; _badString = ""; _goodString = ""; View.SrcNameShow = false; _shownPlayer = null; _control.SourceReset(); }
/***** * Control event react functions */ public void CommandPlay() { if (log) { View.Log("CommandPlay"); } if (_source == null) { return; } if (_goodPlayer != null && _goodPlayer.IsPlaying) { _shownPlayer = _goodPlayer; View.ShowGoodPlayer(); } else { _shownPlayer = _badPlayer; _badPlayer.Play(); } CheckNeedSwitch(); }
private void SetSource(Camera source) { if (log) { View.Log("SetSource"); } if (_settings == null) { return; } source.position = _position; if (String.IsNullOrEmpty(source.rtspBad)) { if (String.IsNullOrEmpty(source.rtspGood)) { return; //todo: generate error message on empty bad (and good?) strings } _badString = source.rtspGood; _goodString = ""; } else { _badString = source.rtspBad; _goodString = source.rtspGood; } if (_badPlayer == null) { CreateBadSource(); } _badPlayer.SetSourceString(_badString); _badPlayer.SetAspectRatio(source.aspectRatio); _badPlayer.Volume = 0; _badPlayer.LostRtspRetryMin = _settings.alert.email.whenDissapearMin; if (!String.IsNullOrEmpty(_goodString)) { if (_goodPlayer == null) { _goodPlayer = Controller.Get <PlayerPresenter>(); View.SetGoodPlayerControl(_goodPlayer.Control); _goodPlayer.Playing += GoodPlaying; _goodPlayer.Stopped += GoodStopped; _goodPlayer.SoundDetected += GoodSoundDetected; _goodPlayer.Buffering += GoodBuffering; _goodPlayer.LostStream += SignalLostF; _goodPlayer.LostStreamRestored += SignalRestoredF; _goodPlayer.LostRtspRetryMin = _settings.alert.email.whenDissapearMin; } _goodPlayer.SetSourceString(_goodString); _goodPlayer.SetAspectRatio(source.aspectRatio); _goodPlayer.Volume = _badPlayer.Volume; _goodPlayer.LostRtspRetryMin = _settings.alert.email.whenDissapearMin; } View.SrcName = source.name; View.SrcNameShow = source.nameView.enabled; NameView nv = source.nameView.inheritGlobal ? _settings.nameView : source.nameView; View.SrcNameAutoHide = nv.autoHide; View.SrcNameColor = nv.color; View.SrcNameBg = nv.paintBg; View.SrcNameBgColor = nv.bgColor; View.SrcNameSize = nv.size; View.SrcNameAlign = (int)nv.position; View.SrcNameShowSec = nv.autoHideSec; View.SrcNameRefresh(); _source = source; if (!_badPlayer.IsPlaying) // todo: can be Buffering, SourceSet need not! { View.HidePlayer = true; _badH = 0; _badW = 0; _control.SourceSet(); } if (_settings.autoplay_now == 1) { CommandPlay(); } }