private void Initialise() { BaseMediaPlayer mediaPlayer = CreatePlatformMediaPlayer(); if (mediaPlayer != null) { // Set-up interface m_Control = mediaPlayer; m_Texture = mediaPlayer; m_Info = mediaPlayer; m_Player = mediaPlayer; m_Dispose = mediaPlayer; if (!s_GlobalStartup) { #if UNITY_5 Debug.Log(string.Format("[AVProVideo] Initialising AVPro Video (script v{0} plugin v{1}) on {2}/{3} (MT {4})", Helper.ScriptVersion, mediaPlayer.GetVersion(), SystemInfo.graphicsDeviceName, SystemInfo.graphicsDeviceVersion, SystemInfo.graphicsMultiThreaded)); #else Debug.Log(string.Format("[AVProVideo] Initialising AVPro Video (script v{0} plugin v{1}) on {2}/{3}", Helper.ScriptVersion, mediaPlayer.GetVersion(), SystemInfo.graphicsDeviceName, SystemInfo.graphicsDeviceVersion)); #endif #if AVPROVIDEO_BETA_SUPPORT_TIMESCALE Debug.LogWarning("[AVProVideo] TimeScale support used. This could affect performance when changing Time.timeScale or Time.captureFramerate. This feature is useful for supporting video capture system that adjust time scale during capturing."); #endif s_GlobalStartup = true; } } }
internal void Start(BaseMediaPlayer player) { _player = player; Reset(); bool vsyncEnabled = true; if (QualitySettings.vSyncCount == 0) { vsyncEnabled = false; if (LogIssues) { Debug.LogWarning("[AVProVideo][Quality] VSync is currently disabled in Quality Settings"); } } if (!IsGameViewVSyncEnabled()) { vsyncEnabled = false; if (LogIssues) { Debug.LogWarning("[AVProVideo][Quality] VSync is currently disabled in the Game View"); } } float frameRate = _player.GetVideoFrameRate(); float frameMs = (1000f / frameRate); if (LogIssues) { Debug.Log(string.Format("[AVProVideo][Quality] Video: {0}fps {1}ms", frameRate, frameMs)); } if (vsyncEnabled) { float vsyncRate = (float)Screen.currentResolution.refreshRate / QualitySettings.vSyncCount; float vsyncMs = (1000f / vsyncRate); if (LogIssues) { Debug.Log(string.Format("[AVProVideo][Quality] VSync: {0}fps {1}ms", vsyncRate, vsyncMs)); } float framesPerVSync = frameMs / vsyncMs; float fractionalframesPerVsync = framesPerVSync - Mathf.FloorToInt(framesPerVSync); if (fractionalframesPerVsync > 0.0001f && LogIssues) { Debug.LogWarning("[AVProVideo][Quality] Video is not a multiple of VSync so playback cannot be perfect"); } VSyncStatus = "VSync " + framesPerVSync; } else { if (LogIssues) { Debug.LogWarning("[AVProVideo][Quality] Running without VSync enabled"); } VSyncStatus = "No VSync"; } }
public virtual BaseMediaPlayer CreatePlatformMediaPlayer() { BaseMediaPlayer baseMediaPlayer = null; WindowsMediaPlayer.InitialisePlatform(); baseMediaPlayer = new WindowsMediaPlayer(_optionsWindows.videoApi, _optionsWindows.useHardwareDecoding, _optionsWindows.forceAudioOutputDeviceName, _optionsWindows.useUnityAudio); if (baseMediaPlayer == null) { Debug.LogWarning("[AVProVideo] Not supported on this platform. Using placeholder player!"); baseMediaPlayer = new NullMediaPlayer(); } return baseMediaPlayer; }
public virtual BaseMediaPlayer CreatePlatformMediaPlayer() { BaseMediaPlayer mediaPlayer = null; #if !AVPROVIDEO_FORCE_NULL_MEDIAPLAYER // Setup for running in the editor (Either OSX, Windows or Linux) #if UNITY_EDITOR #if (UNITY_EDITOR_OSX) #if UNITY_EDITOR_64 mediaPlayer = new OSXMediaPlayer(); #else Debug.LogError("[AVProVideo] 32-bit OS X Unity editor not supported. 64-bit required."); #endif #elif UNITY_EDITOR_WIN WindowsMediaPlayer.InitialisePlatform(); mediaPlayer = new WindowsMediaPlayer(_optionsWindows.forceDirectShowApi, _optionsWindows.forceAudioOutputDeviceName); #endif #else // Setup for running builds #if (UNITY_STANDALONE_WIN || UNITY_WSA_10_0 || UNITY_WINRT_8_1) WindowsMediaPlayer.InitialisePlatform(); mediaPlayer = new WindowsMediaPlayer(_optionsWindows.forceDirectShowApi, _optionsWindows.forceAudioOutputDeviceName); #elif (UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS) mediaPlayer = new OSXMediaPlayer(); #elif (UNITY_ANDROID) // Initialise platform (also unpacks videos from StreamingAsset folder (inside a jar), to the persistent data path) AndroidMediaPlayer.InitialisePlatform(); mediaPlayer = new AndroidMediaPlayer(); #elif (UNITY_WEBGL) WebGLMediaPlayer.InitialisePlatform(); mediaPlayer = new WebGLMediaPlayer(); #endif #endif #endif // Fallback if (mediaPlayer == null) { Debug.LogWarning("[AVProVideo] Not supported on this platform. Using placeholder player!"); mediaPlayer = new NullMediaPlayer(); } return mediaPlayer; }
protected void Initialise() { BaseMediaPlayer baseMediaPlayer = CreatePlatformMediaPlayer(); if (baseMediaPlayer != null) { m_Control = baseMediaPlayer; m_Texture = baseMediaPlayer; m_Info = baseMediaPlayer; m_Player = baseMediaPlayer; m_Dispose = baseMediaPlayer; if (!s_GlobalStartup) { Helper.LogInfo(string.Format("Initialising AVPro Video (script v{0} plugin v{1}) on {2}/{3} (MT {4})", "1.5.8", baseMediaPlayer.GetVersion(), SystemInfo.graphicsDeviceName, SystemInfo.graphicsDeviceVersion, SystemInfo.graphicsMultiThreaded)); s_GlobalStartup = true; } } }
private BaseMediaPlayer CreatePlatformMediaPlayer() { BaseMediaPlayer mediaPlayer = null; // Setup for running in the editor (Either OSX, Windows or Linux) #if UNITY_EDITOR #if (UNITY_EDITOR_OSX) #if UNITY_EDITOR_64 mediaPlayer = new OSXMediaPlayer(); #else Debug.LogWarning("[AVProVideo] 32-bit OS X Unity editor not supported. 64-bit required."); #endif #elif UNITY_EDITOR_WIN WindowsMediaPlayer.InitialisePlatform(); mediaPlayer = new WindowsMediaPlayer(); #endif #else // Setup for running builds #if (UNITY_STANDALONE_WIN) WindowsMediaPlayer.InitialisePlatform(); mediaPlayer = new WindowsMediaPlayer(); //Windows_VLC_MediaPlayer.InitialisePlatform(); //mediaPlayer = new Windows_VLC_MediaPlayer(); #elif (UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS) mediaPlayer = new OSXMediaPlayer(); #elif (UNITY_ANDROID) // Initialise platform (also unpacks videos from StreamingAsset folder (inside a jar), to the persistent data path) AndroidMediaPlayer.InitialisePlatform(); mediaPlayer = new AndroidMediaPlayer(); #elif (UNITY_WP8) // TODO: add Windows Phone 8 suppport #elif (UNITY_WP81) // TODO: add Windows Phone 8.1 suppport #endif #endif // Fallback if (mediaPlayer == null) { Debug.LogWarning("[AVProVideo] Not supported on this platform. Using placeholder video!"); mediaPlayer = new NullMediaPlayer(); } return(mediaPlayer); }
public void Start() { BaseMediaPlayer mediaPlayer = CreatePlatformMediaPlayer(); if (mediaPlayer != null) { // Set-up interface m_Control = mediaPlayer; m_Texture = mediaPlayer; m_Dispose = mediaPlayer; m_Info = mediaPlayer; m_Player = mediaPlayer; if (!s_GlobalStartup) { #if UNITY_5 Debug.Log(string.Format("[AVProVideo] Initialising AVPro Video (script v{0} plugin v{1}) on {2}/{3} (MT {4})", Helper.ScriptVersion, mediaPlayer.GetVersion(), SystemInfo.graphicsDeviceName, SystemInfo.graphicsDeviceVersion, SystemInfo.graphicsMultiThreaded)); #else Debug.Log(string.Format("[AVProVideo] Initialising AVPro Video (script v{0} plugin v{1}) on {2}/{3}", Helper.ScriptVersion, mediaPlayer.GetVersion(), SystemInfo.graphicsDeviceName, SystemInfo.graphicsDeviceVersion)); #endif s_GlobalStartup = true; } // Open? if (m_AutoOpen) { OpenVideoFromFile(); } SetPlaybackOptions(); if (m_Control != null) { StartCoroutine("FinalRenderCapture"); } } }