Exemple #1
0
        /// <summary>
        /// Gets a clip from the list of clips.
        /// </summary>
        /// <param name="clipPath">The path of the clip that will be given.</param>
        /// <returns>The clip</returns>
        public VideoClip GetClip(string clipPath)
        {
            VideoClipPath clip = _clips.FirstOrDefault(x => x.path == clipPath);

            Debug.Log(clip);
            if (clip == null)
            {
                return(null);
            }
            return(clip.videoClip);
        }
Exemple #2
0
        /// <summary>
        /// Stops a specific clip.
        /// </summary>
        /// <param name="clipPath">Path of the clip that will be stopped</param>
        public void StopClip(string clipPath)
        {
            VideoClipPath clip = _clips.FirstOrDefault(x => x.path == clipPath);

            if (clip == null)
            {
                Debug.LogError("No video for path \"" + clipPath + "\"");
            }
            else if (clip.videoClip == _videoPlayer.clip && _videoPlayer.isPlaying)
            {
                _videoPlayer.Stop();
            }
        }
Exemple #3
0
        /// <summary>
        /// Plays the clip corresponding to the parameter's path
        /// </summary>
        /// <param name="clipPath">The path of the clip that will be played</param>
        public void PlayClip(string clipPath, RenderTexture targetTexture)
        {
            VideoClipPath clip = _clips.FirstOrDefault(x => x.path == clipPath);

            if (clip == null)
            {
                Debug.LogError("No video for path \"" + clipPath + "\"");
            }
            else
            {
                if (_videoPlayer.clip != null)
                {
                    _videoPlayer.Stop();
                }
                _videoPlayer.clip          = clip.videoClip;
                _videoPlayer.targetTexture = targetTexture;
                _videoPlayer.Play();
            }
        }