Ejemplo n.º 1
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            if (m_Clips == null)
            {
                return;
            }

            int inputPort = 0;

            foreach (TimelineClip clip in m_Clips)
            {
                ScriptPlayable <VideoPlayableBehaviour> scriptPlayable =
                    (ScriptPlayable <VideoPlayableBehaviour>)playable.GetInput(inputPort);

                VideoPlayableBehaviour videoPlayableBehaviour = scriptPlayable.GetBehaviour();

                if (videoPlayableBehaviour != null)
                {
                    double preloadTime = Math.Max(0.0, videoPlayableBehaviour.preloadTime);
                    if (m_Director.time >= clip.start + clip.duration ||
                        m_Director.time <= clip.start - preloadTime)
                    {
                        videoPlayableBehaviour.StopVideo();
                    }
                    else if (m_Director.time > clip.start - preloadTime)
                    {
                        videoPlayableBehaviour.PrepareVideo();
                    }
                }

                ++inputPort;
            }
        }
Ejemplo n.º 2
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            ScriptPlayable <VideoPlayableBehaviour> playable =
                ScriptPlayable <VideoPlayableBehaviour> .Create(graph);

            VideoPlayableBehaviour playableBehaviour = playable.GetBehaviour();

            playableBehaviour.videoPlayer = videoPlayer.Resolve(graph.GetResolver());
            playableBehaviour.videoClip   = videoClip;
            playableBehaviour.mute        = mute;
            playableBehaviour.loop        = loop;
            playableBehaviour.preloadTime = preloadTime;
            playableBehaviour.clipInTime  = clipInTime;

            return(playable);
        }