Пример #1
0
    public void PlayPauseToggle()
    {
        if (isEnded)
        {
            isEnded = false;
            progressBarImg.fillAmount = 0;
            progressBar.value         = 0;
            videoPlayer.Stop();
            StopCoroutine(PlayVideo());
            StartCoroutine(PlayVideo());
            videoPlayer.Play();
            StartCoroutine(Controllers.FadeOut());
            StartCoroutine(playButton.FadeOut());
            StartCoroutine(pauseButton.FadeIn());
            return;
        }

        if (videoPlayer.isPlaying)
        {
            videoPlayer.Pause();
            StartCoroutine(playButton.FadeIn());
            StartCoroutine(pauseButton.FadeOut());
            Controllers.CancelInvoke("FadeOutFunction");
        }
        else
        {
            videoPlayer.Play();
            StartCoroutine(pauseButton.FadeIn());
            StartCoroutine(playButton.FadeOut());
            Controllers.FadeOutFunction();
        }
    }
Пример #2
0
 public void Seek(float seekPoint)
 {
     Controllers.CancelInvoke();
     Controllers.Invoke("FadeOutFunction", 3f);
     Debug.Log("Seeking: " + (long)(seekPoint * (float)videoPlayer.frameCount) + " out of " + videoPlayer.frameCount);
     videoPlayer.frame = (long)(seekPoint * (float)videoPlayer.frameCount);
     videoPlayer.Play();
     StartCoroutine(playButton.FadeOut());
 }
Пример #3
0
 public void BackwardButton()
 {
     canBackward = videoPlayer.time > 0;
     if (!isFirstTouch && canBackward)
     {
         Controllers.CancelInvoke("FadeOutFunction");
         videoPlayer.Pause();
         //StopCoroutine(PlayVideo());
         step            -= 10;
         backwardTxt.text = "" + Mathf.FloorToInt(step);
         backwardTxt.gameObject.SetActive(true);
         forwardBtn.interactable = false;
         CancelInvoke("ResetFirstTouch");
         Invoke("ResetFirstTouch", 0.6f);
     }
     if (isFirstTouch)
     {
         Controllers.Invoke("FadeOutFunction", 1f);
         isFirstTouch = false;
     }
 }
Пример #4
0
 public void ForwardButton()
 {
     canForward = videoPlayer.time < LoadAllVideos.Instance.videos[playingVideoIndex].length;
     if (!isFirstTouch && canForward)
     {
         Controllers.CancelInvoke("FadeOutFunction");
         videoPlayer.Pause();
         //StopCoroutine(PlayVideo());
         step           += 10;
         forwardTxt.text = "+" + Mathf.FloorToInt(step);
         forwardTxt.gameObject.SetActive(true);
         backwardBtn.interactable = false;
         CancelInvoke("ResetFirstTouch");
         Invoke("ResetFirstTouch", 0.6f);
     }
     if (isFirstTouch)
     {
         Controllers.Invoke("FadeOutFunction", 1f);
         isFirstTouch = false;
     }
 }