Ejemplo n.º 1
0
        public override void PlayVideoFromGallery(PickVideoCompletion _onPickVideoCompletion,
                                                  PlayVideoCompletion _onPlayVideoCompletion)
        {
            base.PlayVideoFromGallery(_onPickVideoCompletion, _onPlayVideoCompletion);

            Plugin.Call(NativeInfo.Methods.PLAY_VIDEO_FROM_GALLERY);
        }
		public override void PlayVideoFromGallery (PickVideoCompletion _onPickVideoCompletion,
		                                          PlayVideoCompletion _onPlayVideoCompletion)
		{
			base.PlayVideoFromGallery(_onPickVideoCompletion, _onPlayVideoCompletion);

			Plugin.Call(Native.Methods.PLAY_VIDEO_FROM_GALLERY);
		}
		public override void PlayEmbeddedVideo (string _embedHTMLString, PlayVideoCompletion _onCompletion)
		{
			base.PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
			
			if (!string.IsNullOrEmpty(_embedHTMLString))
				playVideoUsingWebView(_embedHTMLString);
		}
Ejemplo n.º 4
0
        public override void PlayEmbeddedVideo(string _embedHTMLString, PlayVideoCompletion _onCompletion)
        {
            base.PlayEmbeddedVideo(_embedHTMLString, _onCompletion);

            if (!string.IsNullOrEmpty(_embedHTMLString))
            {
                Plugin.Call(NativeInfo.Methods.PLAY_VIDEO_FROM_WEBVIEW, _embedHTMLString);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Allows to pick a video from gallery and play it.
        /// </summary>
        /// <param name="_onPickVideoCompletion">Triggered once pick video action is done. </param>
        /// <param name="_onPlayVideoCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayVideoFromGallery(PickVideoCompletion _onPickVideoCompletion, PlayVideoCompletion _onPlayVideoCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnPickVideoFinished	= _onPickVideoCompletion;
            OnPlayVideoFinished	= _onPlayVideoCompletion;
        }
Ejemplo n.º 6
0
        public override void PlayEmbeddedVideo(string _embedHTMLString, PlayVideoCompletion _onCompletion)
        {
            base.PlayEmbeddedVideo(_embedHTMLString, _onCompletion);

            if (!string.IsNullOrEmpty(_embedHTMLString))
            {
                playVideoUsingWebView(_embedHTMLString);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Allows to pick a video from gallery and play it.
        /// </summary>
        /// <param name="_onPickVideoCompletion">Triggered once pick video action is done. </param>
        /// <param name="_onPlayVideoCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayVideoFromGallery(PickVideoCompletion _onPickVideoCompletion, PlayVideoCompletion _onPlayVideoCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnPickVideoFinished = _onPickVideoCompletion;
            OnPlayVideoFinished = _onPlayVideoCompletion;
        }
Ejemplo n.º 8
0
        public override void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
        {
            base.PlayYoutubeVideo(_videoID, _onCompletion);

            if (!string.IsNullOrEmpty(_videoID))
            {
                Application.OpenURL("http://www.youtube.com/watch?v=" + _videoID);
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED);
            }
        }
		public override void PlayYoutubeVideo (string _videoID, PlayVideoCompletion _onCompletion)
		{
			base.PlayYoutubeVideo(_videoID, _onCompletion);

			if (!string.IsNullOrEmpty(_videoID))
			{
				Application.OpenURL("http://www.youtube.com/watch?v=" + _videoID);
				PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED);
			}
		}	
Ejemplo n.º 10
0
        public override void PlayVideoFromURL(URL _URL, PlayVideoCompletion _onCompletion)
        {
            base.PlayVideoFromURL(_URL, _onCompletion);

            if (!string.IsNullOrEmpty(_URL.URLString))
            {
                Application.OpenURL(_URL.URLString);
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED);
            }
        }
Ejemplo n.º 11
0
 public override void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
 {
     if (string.IsNullOrEmpty(NPSettings.MediaLibrary.Android.YoutubeAPIKey))
     {
         base.PlayYoutubeVideo(_videoID, _onCompletion);
     }
     else
     {
         Plugin.Call(NativeInfo.Methods.PLAY_VIDEO_FROM_YOUTUBE, _videoID);
     }
 }
Ejemplo n.º 12
0
        public override void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
        {
            base.PlayYoutubeVideo(_videoID, _onCompletion);

            if (!string.IsNullOrEmpty(_videoID))
            {
                // Get Embed String
                string _embedHTMLString = GetYoutubeEmbedHTMLString(_videoID);

                // Play video
                PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
            }
        }
		public override void PlayYoutubeVideo (string _videoID, PlayVideoCompletion _onCompletion)
		{
			base.PlayYoutubeVideo(_videoID, _onCompletion);

			if(!string.IsNullOrEmpty(_videoID))
			{
				// Get Embed String
				string _embedHTMLString = GetYoutubeEmbedHTMLString(_videoID);
				
				// Play video
				PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
			}
		}	
Ejemplo n.º 14
0
        /// <summary>
        /// Plays youtube video for the corresponding video id specified.
        /// </summary>
        /// <param name="_videoID">Video id of the youtube video.</param>
        /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
        {
            // Load Youtube player HTML script
            TextAsset _youtubePlayerHTML = Resources.Load("YoutubePlayer", typeof(TextAsset)) as TextAsset;
            string    _embedHTMLString   = null;

            if (_youtubePlayerHTML != null)
            {
                _embedHTMLString = _youtubePlayerHTML.text.Replace("%@", _videoID);
            }

            // Play video
            PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Plays embedded video using web view.
        /// </summary>
        /// <param name="_embedHTMLString">Embed HTML string to load in the webview.</param>
        /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayEmbeddedVideo(string _embedHTMLString, PlayVideoCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnPlayVideoFinished = _onCompletion;

            if (string.IsNullOrEmpty(_embedHTMLString))
            {
                Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play video using webview failed, HTML string cant be null");
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
                return;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Play video from specified URL. This can be an URL pointing to local/remote file.
        /// </summary>
        ///	<remarks>\warning This URL needs to point directly to the video. Direct video link ex: www.voxelbusters.com/movie.mp4 </remarks>
        /// <param name="_URL">URL of the video to play.</param>
        /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayVideoFromURL(URL _URL, PlayVideoCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnPlayVideoFinished = _onCompletion;

            if (string.IsNullOrEmpty(_URL.URLString))
            {
                Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play video from URL failed, URL can't be null");
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
                return;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Plays youtube video for the corresponding video id specified.
        /// </summary>
        /// <param name="_videoID">Video id of the youtube video.</param>
        /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnPlayVideoFinished = _onCompletion;

            if (string.IsNullOrEmpty(_videoID))
            {
                Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play youtube video failed, Video ID can't be null");
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
                return;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Plays embedded video using web view.
        /// </summary>
        /// <param name="_embedHTMLString">Embed HTML string to load in the webview.</param>
        /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayEmbeddedVideo(string _embedHTMLString, PlayVideoCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnPlayVideoFinished	= _onCompletion;

            if (string.IsNullOrEmpty(_embedHTMLString))
            {
                Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play video using webview failed, HTML string cant be null");
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
                return;
            }
        }
Ejemplo n.º 19
0
        public override void PlayVideoFromURL(URL _URL, PlayVideoCompletion _onCompletion)
        {
            base.PlayVideoFromURL(_URL, _onCompletion);

            if (!string.IsNullOrEmpty(_URL.URLString))
            {
                // Check if this url is a youtube link
                string _youtubeID = ExtractYoutubeVideoID(_URL.URLString);

                if (_youtubeID != null)
                {
                    PlayYoutubeVideo(_youtubeID, _onCompletion);
                }
                else
                {
                    playVideoFromURL(_URL.URLString);
                }
            }
        }
Ejemplo n.º 20
0
        public override void PlayVideoFromURL(URL _URL,
                                              PlayVideoCompletion _onCompletion)
        {
            base.PlayVideoFromURL(_URL, _onCompletion);

            if (!string.IsNullOrEmpty(_URL.URLString))
            {
                string _youtubeID = ExtractYoutubeVideoID(_URL.URLString);

                if (_youtubeID != null)
                {
                    PlayYoutubeVideo(_youtubeID, _onCompletion);
                }
                else
                {
                    Plugin.Call(NativeInfo.Methods.PLAY_VIDEO_FROM_URL, _URL.URLString);
                }
            }
        }
		public override void PlayVideoFromURL (URL _URL, 
		                                      PlayVideoCompletion _onCompletion)
		{
			base.PlayVideoFromURL(_URL, _onCompletion);
			
			if (!string.IsNullOrEmpty(_URL.URLString))
			{
				string _youtubeID = ExtractYoutubeVideoID(_URL.URLString);
				
				if(_youtubeID != null)
				{
					PlayYoutubeVideo(_youtubeID, _onCompletion);
				}
				else
				{
					Plugin.Call(Native.Methods.PLAY_VIDEO_FROM_URL, _URL.URLString);
				}
			}
		}
Ejemplo n.º 22
0
        public override void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
        {
            base.PlayYoutubeVideo(_videoID, _onCompletion);

            if (!string.IsNullOrEmpty(_videoID))
            {
                if (string.IsNullOrEmpty(NPSettings.MediaLibrary.Android.YoutubeAPIKey))
                {
                    // Get Embed String
                    string _embedHTMLString = GetYoutubeEmbedHTMLString(_videoID);

                    // Play video
                    PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
                }
                else
                {
                    Plugin.Call(Native.Methods.PLAY_VIDEO_FROM_YOUTUBE, _videoID);
                }
            }
        }
		public override void PlayYoutubeVideo (string _videoID, PlayVideoCompletion _onCompletion)
		{
			base.PlayYoutubeVideo(_videoID, _onCompletion);

			if(!string.IsNullOrEmpty(_videoID))
			{
				if (string.IsNullOrEmpty(NPSettings.MediaLibrary.Android.YoutubeAPIKey))
				{
					// Get Embed String
					string _embedHTMLString = GetYoutubeEmbedHTMLString(_videoID);

					// Play video
					PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
				}
				else
				{
					Plugin.Call(Native.Methods.PLAY_VIDEO_FROM_YOUTUBE, _videoID);
				}
			}
		}	
		public override void PlayEmbeddedVideo (string _embedHTMLString, PlayVideoCompletion _onCompletion)
		{
			base.PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
			
			if (!string.IsNullOrEmpty(_embedHTMLString))
			{
				string _tempPath = FileUtil.GetUniqueTempPathInProject() + ".html";

				Console.LogError(Constants.kDebugTag, _tempPath);
				System.IO.StreamWriter _stream = FileOperations.CreateText(_tempPath);
				_stream.Write(_embedHTMLString);
				_stream.Close();
				
				// Open URL
				Application.OpenURL("file://" + Application.dataPath + "/../" + _tempPath);

				// Associated error event is raised
				PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED);
			}
		}
		public override void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion)
		{
			base.PlayVideoFromURL(_URL, _onCompletion);
			
			if (!string.IsNullOrEmpty(_URL.URLString))
			{
				// Check if this url is a youtube link
				string _youtubeID = ExtractYoutubeVideoID(_URL.URLString);

				if(_youtubeID != null)
				{
					PlayYoutubeVideo(_youtubeID, _onCompletion);
				}
				else
				{
					playVideoFromURL(_URL.URLString);
				}

			}
		}
Ejemplo n.º 26
0
        public override void PlayEmbeddedVideo(string _embedHTMLString, PlayVideoCompletion _onCompletion)
        {
            base.PlayEmbeddedVideo(_embedHTMLString, _onCompletion);

            if (!string.IsNullOrEmpty(_embedHTMLString))
            {
                string _tempPath = FileUtil.GetUniqueTempPathInProject() + ".html";

                Console.LogError(Constants.kDebugTag, _tempPath);
                System.IO.StreamWriter _stream = FileOperations.CreateText(_tempPath);
                _stream.Write(_embedHTMLString);
                _stream.Close();

                // Open URL
                Application.OpenURL("file://" + Application.dataPath + "/../" + _tempPath);

                // Associated error event is raised
                PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED);
            }
        }
		public override void PlayVideoFromGallery (PickVideoCompletion _onPickVideoCompletion, PlayVideoCompletion _onPlayVideoCompletion)
		{
			base.PlayVideoFromGallery(_onPickVideoCompletion, _onPlayVideoCompletion);

			m_gallery.PickVideoFromGallery();
			
			// Feature isnt supported
			Console.LogWarning(Constants.kDebugTag, "Video Playback from gallery not supported on Editor");

			// Associated event is raised.
			PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
		}
		/// <summary>
		/// Play video from specified URL. This can be an URL pointing to local/remote file. 
		/// </summary>
		///	<remarks>\warning This URL needs to point directly to the video. Direct video link ex: www.voxelbusters.com/movie.mp4 </remarks>
		/// <param name="_URL">URL of the video to play.</param>
		/// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
		public virtual void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion)
		{
			// Pause unity player
			this.PauseUnity();

			// Cache callback
			OnPlayVideoFinished	= _onCompletion;

			if (string.IsNullOrEmpty(_URL.URLString))
			{
				Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play video from URL failed, URL can't be null");
				PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
				return;
			}
		}
Ejemplo n.º 29
0
        public override void PlayVideoFromGallery(PickVideoCompletion _onPickVideoCompletion, PlayVideoCompletion _onPlayVideoCompletion)
        {
            base.PlayVideoFromGallery(_onPickVideoCompletion, _onPlayVideoCompletion);

            m_gallery.PickVideoFromGallery();

            // Feature isnt supported
            Console.LogWarning(Constants.kDebugTag, "Video Playback from gallery not supported on Editor");

            // Associated event is raised.
            PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
        }
		public override void PlayEmbeddedVideo (string _embedHTMLString, PlayVideoCompletion _onCompletion)
		{
			base.PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
			
			if (!string.IsNullOrEmpty(_embedHTMLString))
				Plugin.Call(Native.Methods.PLAY_VIDEO_FROM_WEBVIEW, _embedHTMLString);
		}
Ejemplo n.º 31
0
        public override void PlayVideoFromGallery(PickVideoCompletion _onPickVideoCompletion, PlayVideoCompletion _onPlayVideoCompletion)
        {
            base.PlayVideoFromGallery(_onPickVideoCompletion, _onPlayVideoCompletion);

            // Native call
            playVideoFromGallery();
        }
		public override void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion)
		{
			base.PlayVideoFromURL(_URL, _onCompletion);
			
			if (!string.IsNullOrEmpty(_URL.URLString))
			{
				Application.OpenURL(_URL.URLString);
				PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED);
			}
		}
		public override void PlayVideoFromGallery (PickVideoCompletion _onPickVideoCompletion, PlayVideoCompletion _onPlayVideoCompletion)
		{
			base.PlayVideoFromGallery(_onPickVideoCompletion, _onPlayVideoCompletion);
			
			// Native call
			playVideoFromGallery();
		}
		/// <summary>
		/// Plays youtube video for the corresponding video id specified.
		/// </summary>
		/// <param name="_videoID">Video id of the youtube video.</param>
		/// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
		public virtual void PlayYoutubeVideo (string _videoID, PlayVideoCompletion _onCompletion)
		{	
			// Pause unity player
			this.PauseUnity();
		
			// Cache callback
			OnPlayVideoFinished	= _onCompletion;

			if (string.IsNullOrEmpty(_videoID))
			{
				Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play youtube video failed, Video ID can't be null");
				PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR);
				return;
			}
		}
Ejemplo n.º 35
0
        /// <summary>
        /// Plays youtube video for the corresponding video id specified.
        /// </summary>
        /// <param name="_videoID">Video id of the youtube video.</param>
        /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param>
        public virtual void PlayYoutubeVideo(string _videoID, PlayVideoCompletion _onCompletion)
        {
            // Load Youtube player HTML script
            TextAsset _youtubePlayerHTML	= Resources.Load("YoutubePlayer", typeof(TextAsset)) as TextAsset;
            string _embedHTMLString			= null;

            if (_youtubePlayerHTML != null)
            {
                _embedHTMLString			= _youtubePlayerHTML.text.Replace("%@", _videoID);
            }

            // Play video
            PlayEmbeddedVideo(_embedHTMLString, _onCompletion);
        }