Using new Unity VideoPlayer and VideoClip API to play video

后端 未结 4 2386
栀梦
栀梦 2020-11-22 01:50

MovieTexture is finally deprecated after Unity 5.6.0b1 release and new API that plays video on both Desktop and Mobile devices is now released.

VideoPlayer and Video

4条回答
  •  独厮守ぢ
    2020-11-22 02:17

    Similar to what the other answers have been saying. You could use callbacks for when preparing and end of video states. Rather than using coroutines and yield return.

    videoPlayer.loopPointReached += EndReached;
    videoPlayer.prepareCompleted += PrepareCompleted;
    
    void PrepareCompleted(VideoPlayer vp) {
        vp.Play();
    }
    
    void EndReached(VideoPlayer vp) {
        // do something
    }
    

提交回复
热议问题