public void Play() { Log.Info("PlaybackWindow.Play1", string.Format("IsPlaying:{0},AbleToPlay:{1},IsReady:{2},Length:{3},AutoPlay:{4}", Player.IsPlaying, Player.AbleToPlay, Player.IsReady, Player.Length, Player.AutoPlay)); if (Player.IsPlaying) { Player.Stop(); Log.Info("PlaybackWindow.Play", "Stop"); } //Player.Play(); //ContentMask.SetActive(false); Player.AutoPlay = true; Player.Play(); ContentMask.SetActive(false); StartPlay = true; Log.Info("PlaybackWindow.Play2", string.Format("IsPlaying:{0},AbleToPlay:{1},IsReady:{2},Length:{3},AutoPlay:{4}", Player.IsPlaying, Player.AbleToPlay, Player.IsReady, Player.Length, Player.AutoPlay)); }
/// <summary> /// 显示视屏(通过Rtsp地址) /// </summary> /// <param name="rtspUrl"></param> public void ShowVideo(string rtspUrl, DevInfo devInfo) { if (window) { window.SetActive(true); } if (connectBg) { connectBg.SetActive(true); } tempDevInfo = devInfo; if (string.IsNullOrEmpty(rtspUrl)) { Debug.LogError("Error : RtspVideo.ShowVideo-> rtspURL is null!"); UGUIMessageBox.Show("Rtsp地址未输入,是否启用霍尼韦尔视频?", "确定", "取消", ShowHoneyWellVideo, Close, Close); return; } if (player) { if (player.IsPlaying) { player.Stop(); } player.Path = rtspUrl; player.Play(); } else { Debug.LogError("Error : RtspVideo.ShowVideo-> UniversalMediaPlayer is null!"); } }
/// <summary> /// 显示视屏(通过Rtsp地址) /// </summary> /// <param name="rtspUrl"></param> public void ShowVideo(string rtspUrl, UniversalMediaPlayer vedioPlayer) { try { if (connectBg) { connectBg.SetActive(true); } if (vedioPlayer) { if (vedioPlayer.Player == null) { Debug.LogError("Error : RtspVideo.ShowVideo-> vedioPlayer.Player == null!"); return; } if (vedioPlayer.IsPlaying) { vedioPlayer.Stop(); } vedioPlayer.Path = rtspUrl; vedioPlayer.Volume = 100; vedioPlayer.PlayRate = 1; vedioPlayer.Play(); } else { Debug.LogError("Error : RtspVideo.ShowVideo-> UniversalMediaPlayer is null!"); } } catch (Exception ex) { Debug.LogError("Error : RtspVideo.ShowVideo-> " + ex); } }
public void StreamingToggle() { if (isStreaming == false) { ump.Path = "rtsp://" + ipAddress.text + ":8554"; ump.Play(); isStreaming = true; txtStreaming.text = "스트리밍 멈춤"; btnLeft.interactable = true; btnRight.interactable = true; btnUp.interactable = true; btnDown.interactable = true; btnZoomIn.interactable = true; btnZoomOut.interactable = true; } else { ump.Stop(); cctvView.texture = null; isStreaming = false; txtStreaming.text = "스트리밍 시작"; btnLeft.interactable = false; btnRight.interactable = false; btnUp.interactable = false; btnDown.interactable = false; btnZoomIn.interactable = false; btnZoomOut.interactable = false; } }
private void Play(string url) { Url = url; if (TbURL != null) { TbURL.text = url; } else { Debug.LogError("TbURL == null"); } if (Player != null) { Player.Path = url; } else { Debug.LogError("Player == null"); } if (PlayAction != null) { PlayAction(url); } else { Player.Stop(); Player.Play(); PlayVideo(); } }
/// <summary> /// 关闭视频 /// </summary> public void Close() { if (player == null) { return; } player.Stop(); DestroyImmediate(player.gameObject); }
void OnClickBack() { AdminMessage msg = new AdminMessage(); msg.Type = DataType.AdminEvent; msg.Data.Control = ControlState.Stop; NetManager.SendMessage(Util.ObjectToJson(msg)); mediaPlayer.Stop(); videoPLayerRoot.gameObject.SetActive(false); PanManager.AllOpenWithout(PanelName.VideoPlayPanel); PanManager.ClosePanel(PanelName.VideoPlayPanel); }
// ------------------------------------------- /* * We will apply the movement to the camera */ private void PlayUMP(string _phoneNumber) { #if ENABLE_STREAMING if (m_ump == null) { m_ump = GameObject.FindObjectOfType <UniversalMediaPlayer>(); m_ump.RenderingObjects = new GameObject[1]; } else { if (m_ump.IsPlaying) { m_ump.Stop(); } } if (m_ump != null) { m_ump.RenderingObjects[0] = m_streamingWindow.gameObject; m_ump.Path = GameConfiguration.URL_RTMP_SERVER_ASSISTANCE + _phoneNumber; m_ump.Prepare(); m_ump.AddPreparedEvent(OnPreparedVideo); } #endif }
/// <summary> /// 关闭 /// </summary> public void Close() { currentReconnectTime = 0; if (FixedTog != null) { FixedTog.isOn = false; } if (player != null) { if (player.IsPlaying) { player.Stop(); } Destroy(player.gameObject);//等待一秒再删除老播放器 } window.SetActive(false); }
public void StreamingToggle() { if (isStreaming == false) { ump.Path = rtspURL.text; ump.Play(); isStreaming = true; txtStreaming.text = "스트리밍 멈춤"; } else { ump.Stop(); cctvView.texture = null; isStreaming = false; txtStreaming.text = "스트리밍 시작"; } }
/// <summary> /// 显示视屏(通过Rtsp地址) /// </summary> /// <param name="rtspUrl"></param> private void ShowVideo(string rtspUrl, UniversalMediaPlayer vedioPlayer) { if (connectBg) { connectBg.SetActive(true); } if (vedioPlayer) { if (vedioPlayer.IsPlaying) { vedioPlayer.Stop(); } vedioPlayer.Path = rtspUrl; vedioPlayer.Play(); } else { Debug.LogError("Error : RtspVideo.ShowVideo-> UniversalMediaPlayer is null!"); } }
// Update is called once per frame void Update() { if (switchCued) { ump.Play(); switchCued = false; } if (Input.GetKeyUp("1")) { if (using2) { ump.Path = file1; } else { ump.Path = file2; } using2 = !using2; ump.Stop(); switchCued = true; } }
public void StopStream() { universalMediaPlayer.Stop(true); }
// Update is called once per frame void Update() { if (umpSwitchQueued) { umPlayer.Play(); umpSwitchQueued = false; } if (!shouldLoop && umPlayer.Length - umPlayer.Time < 300) { umPlayer.Pause(); //print("End Pause"); } if (umPlayer.Path != curPath) { print("Attempting Change"); // works correctly umPlayer.Stop(); umPlayer.Play(); curPath = umPlayer.Path; } if (fileMode) { umPlayer.Pause(); //print("File Pause"); } if (timeShifting != 0) { umPlayer.Pause(); //print("Timeshift Pause"); progContainer.SetActive(true); vidProgress.enabled = true; vidProgressChange.enabled = true; forwardTime += Time.deltaTime; float shift = timeShifting * 25 * Time.deltaTime * Mathf.Pow(forwardTime, 1.5f); umPlayer.Position += shift * 1000 / umPlayer.Length; //print("Shifting - FTime:" + forwardTime + ", Shift: " + shift); source.volume = 0.0f; } else { progContainer.SetActive(false); vidProgress.enabled = false; vidProgressChange.enabled = false; forwardTime = 0; source.volume = 1.0f; if (!fileMode && umPlayer.Length - umPlayer.Time > 1000 && !umPlayer.IsPlaying) { umPlayer.Play(); } } if (progHover) { progContainer.SetActive(true); vidProgress.enabled = true; vidProgressChange.enabled = true; } timeShifting = 0; float videoLength = umPlayer.Length / 1000f; float vTime = umPlayer.Time / 1000f; vidProgress.fillAmount = vTime / videoLength; int minutes = Mathf.FloorToInt(vTime / 60); int seconds = Mathf.FloorToInt(vTime - 60 * minutes); string vidProgString; if (seconds < 10) { vidProgString = minutes + ":0" + seconds; } else { vidProgString = minutes + ":" + seconds; } timeText.text = vidProgString + "/" + vidLengthString; //print("Frame Extension: " + (vPlayer.frameCount / vPlayer.frameRate)); // this method actually works //print("ClipLength: " + (vPlayer.clip.length / 60)); // 3.8 min is double recorded amount ------ is the same amount for all videos!!! if (Input.GetKeyUp("9")) { Application.LoadLevel(0); } }
private void OnlineAudioConroller() { if (Application.internetReachability == NetworkReachability.NotReachable) { if (isOnline || !isOnline && debug.text == ("You're offline")) { isOnline = false; isRelax = false; isCalm = false; isEnergize = false; isPlaySprite = true; playBtn.sprite = playSpr; debug.text = ("You're offline"); UMP.Stop(); audioSource.Stop(); if (offlineAudioSource.clip != defaultClip) { offlineAudioSource.clip = defaultClip; } if (!offlineAudioSource.isPlaying) { offlineAudioSource.Play(); } } } else { if (!isOnline) { isOnline = true; debug.text = ""; } if (!audioSource.isPlaying) { if (isRelax) { if (offlineAudioSource.isPlaying) { offlineAudioSource.Stop(); } UMP.Path = relaxURL; UMP.Play(); } else if (isCalm) { if (offlineAudioSource.isPlaying) { offlineAudioSource.Stop(); } UMP.Path = calmURL; UMP.Play(); } else if (isEnergize) { if (offlineAudioSource.isPlaying) { offlineAudioSource.Stop(); } UMP.Path = energizeURL; UMP.Play(); } } } }