Ejemplo n.º 1
0
 public async Task PlayVideo(VideoClip videoClip, AudioClip audioClip, Action action)
 {
     if (isSelfValid)
     {
         if (videoClip == null)
         {
             CommonVideoPlayer.FinishJob(this);
             return;
         }
         videoAudio.clip  = audioClip;
         videoPlayer.clip = videoClip;
         videoPlayer.Prepare();
         while (!videoPlayer.isPrepared)
         {
             await UniTask.DelayFrame(1);
         }
         videoPlayer.Play();
         videoAudio.Play();
         TimerComponent timerComponent = ETModel.Game.Scene.GetComponent <ETModel.TimerComponent>();
         int            time_ms        = (int)((videoPlayer.length + 0.5d) * 1000);
         videoPlayer.loopPointReached += (player) => {
             CommonVideoPlayer.FinishJob(this);
             if (action != null)
             {
                 action();
             }
         };
         await UniTask.Delay(time_ms);
     }
 }
Ejemplo n.º 2
0
        public static CommonVideoPlayer GetOnePlayer()
        {
            CommonVideoPlayer result = null;
            GameObject        prefab = Resources.Load <GameObject>("CommonVideoPlayer");

            if (prefab != null)
            {
                GameObject clone = GameObject.Instantiate <GameObject>(prefab);
                result = new CommonVideoPlayer(clone);
            }
            return(result);
        }
Ejemplo n.º 3
0
 public static void FinishJob(CommonVideoPlayer commonVideoPlayer)
 {
     commonVideoPlayer.FinishPlay();
 }