using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Video;
public class PlayVideo : MonoBehaviour {
?? ?public VideoPlayer videoPlayer; ?? ?public List<VideoClip> videoClips;
?void Start() ? ? { ?? ?//默认播放指定视频 ?? ?Videolength(); }
?void Videolength() ? ? { ? ? ? ?? ? ? ? ? ? ? Debug.Log("vpLoop..." + " ? " + "_clipsIndex ? :" + _clipsIndex); ? ? ? ? ? ? long frame = videoPlayer.frame;//视频帧 ? ? ? ? ? ? ulong frameCount = videoPlayer.clip.frameCount;//视频总帧 ? ? ? ? ? ? Debug.Log("frame ?:"+frame+" ? ?"+ "frameCount ? :" + frameCount); //如果视频帧大于等于视频总帧 ? ? ? ? ? ? if (frame >= (long)frameCount - 1) ? ? ? ? ? ? { //播放指定视频"videoClips[11]",[ ]中填写指定的视频 ? ? ? ? ? ? ? ? videoPlayer.clip = videoClips[11]; ? ? ? ? ? ? ? ? videoPlayer.Play(); ? ? ? ? ? ? } ? ? }
}
|