Forum rules - please read before posting.

Video Seek Request

Would it at all be possible to request a 'Video Seek' into the VideoPlayer component?

For example, if we have one long video clip with multiple scenes in, it would be nice to 'jump' and resume play from that exact moment we set in the component. For example:

SeekAndResume from 24:06:29.

Comments

  • Did you mean to post a video? Try copy/pasting the link directly.

  • Hey Chris, no, there wasn't supposed to be a videoclip.

    I'm just wondering if it would be possible to implement a 'seek' function into AC's videoplayer component so it could immiedately jump to and play the video from the specified time set.

  • It depends on what Unity makes available, but I will look into it.

  • OK, so Unity does offer a little in the way of scrubbing in the form of .time and .frame properties - see here.

    However, it doesn't seem to be too reliable. The video needs to be preloaded beforehand - at least up until the frame you wish to skip to, and even then behaviour doesn't seem to be consistent.

    It'd be fairly trivial to write a custom Action that sets e.g. the frame value of a VideoPlayer component, but without consistency I wouldn't be looking to make it official.

    using UnityEngine;
    using UnityEngine.Video;
    #if UNITY_EDITOR
    using UnityEditor;
    #endif
    
    namespace AC
    {
    
        [System.Serializable]
        public class ActionVideoScrub : Action
        {
    
            public VideoPlayer videoPlayer;
            public int newFrame;
    
    
            public ActionVideoScrub ()
            {
                this.isDisplayed = true;
                category = ActionCategory.Custom;
                title = "Set video time";
            }
    
    
            public override float Run ()
            {
                videoPlayer.frame = newFrame;
                return 0f;
            }
    
    
            #if UNITY_EDITOR
    
            public override void ShowGUI ()
            {
                videoPlayer = (VideoPlayer) EditorGUILayout.ObjectField ("Video player:", videoPlayer, typeof (VideoPlayer), true);
                newFrame = EditorGUILayout.IntField ("New frame:", newFrame);
    
                AfterRunningOption ();
            }
    
    
            #endif
    
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!