Exemple #1
0
        void OnApplicationQuit()
        {
            if (s_GlobalStartup)
            {
                Debug.Log("[AVProVideo] Shutdown");

                // Clean up any open media players
                MediaPlayer[] players = Resources.FindObjectsOfTypeAll <MediaPlayer>();
                if (players != null && players.Length > 0)
                {
                    for (int i = 0; i < players.Length; i++)
                    {
                        players[i].CloseVideo();
                    }
                }

#if UNITY_EDITOR
#if UNITY_EDITOR_WIN
                WindowsMediaPlayer.DeinitPlatform();
#endif
#else
#if (UNITY_STANDALONE_WIN)
                WindowsMediaPlayer.DeinitPlatform();
#endif
#endif
                s_GlobalStartup = false;
            }
        }
		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;
		}
Exemple #3
0
		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;
		}
		private void OnApplicationQuit()
		{
			if (s_GlobalStartup)
			{
				Helper.LogInfo("Shutdown");
				MediaPlayer[] array = Resources.FindObjectsOfTypeAll<MediaPlayer>();
				if (array != null && array.Length > 0)
				{
					for (int i = 0; i < array.Length; i++)
					{
						array[i].CloseVideo();
					}
				}
				WindowsMediaPlayer.DeinitPlatform();
				s_GlobalStartup = false;
			}
		}
        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);
        }