public void Stop() { if (_player == null) { return; } _playingState = false; _player.Pause(); }
// 暂停 private void OnPauseButton() { if (mediaPlayer) { mediaPlayer.Pause(); } playBtn.gameObject.SetActive(true); pauseBtn.gameObject.SetActive(false); AdminMessage msg = new AdminMessage(); msg.Type = DataType.AdminEvent; msg.Data.Control = ControlState.Pause; NetManager.SendMessage(Util.ObjectToJson(msg)); }
// 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); } }
public void Pause() { Player.Pause(); ContentMask.SetActive(true); LengthText.text = ""; }