1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #if !(UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_TVOS)
- using UnityEngine;
- namespace RenderHeads.Media.AVProVideo
- {
- public partial class MediaPlayer : MonoBehaviour
- {
- #region Application Focus and Pausing
- #if !UNITY_EDITOR
- void OnApplicationFocus(bool focusStatus)
- {
- #if !(UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
- if (focusStatus)
- {
- if (Control != null && _wasPlayingOnPause)
- {
- _wasPlayingOnPause = false;
- Control.Play();
- Helper.LogInfo("OnApplicationFocus: playing video again");
- }
- }
- #endif
- }
- void OnApplicationPause(bool pauseStatus)
- {
- #if !(UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
- if (pauseStatus)
- {
- if (_pauseMediaOnAppPause)
- {
- if (Control!= null && Control.IsPlaying())
- {
- _wasPlayingOnPause = true;
- #if !UNITY_IPHONE
- Control.Pause();
- #endif
- Helper.LogInfo("OnApplicationPause: pausing video");
- }
- }
- }
- else
- {
- if (_playMediaOnAppUnpause)
- {
-
- OnApplicationFocus(true);
- }
- }
- #endif
- }
- #endif
- #endregion // Application Focus and Pausing
- }
- }
- #endif
|