Lens Scripting API

    Class VideoTextureProvider

    Controls a video texture resource. Can be accessed through Texture.control.

    // Plays a video texture
    //@input Asset.Texture movie

    var loops = 100;

    var provider = script.movie.control;
    provider.play(loops);
    //@input Asset.Texture movie
    var provider = script.movie.control;
    var seekTime = 5.0; // Seek to 5 seconds into the video
    if (provider) {
    // The video automatically plays from 5 seconds
    provider.seek(seekTime);
    print("Video resumed from " + seekTime + " seconds");
    } else {
    print("Video control not available");
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    currentPlayCount: number

    Returns the number of played cycles.

    currentTime: number

    Returns the current time in seconds, or zero if accessed during playback being in unprepared state.

    duration: number

    Returns the duration of playback range in seconds, or zero if accessed while playback is in an unprepared state.

    isPlaybackReady: boolean

    Returns true if video file has been loaded and is ready for decoding and false otherwise.

    lastFrameTime: number

    Returns the time of the last acquired texture in seconds, or zero if accessed during playback being in unprepared state.

    onPlaybackDone: event0<void>

    The event for being reported about playback finished. When this event is triggered, lens developers can evict this texture from material slots to avoid disrupting user's experience.

    onPlaybackReady: event0<void>

    The event for being reported about playback start. When this event is triggered, lens developers can set video texture to material slots and see actual video frames.

    playbackRate: number

    The playback rate of the video. The rate is set when starting playback, meaning that updates to this property does not take effect until the video is stopped and started again. Defaults to 1.

    relativeEndTime: number

    Sets or returns playback end time in unit range.

    relativeStartTime: number

    Sets or returns playback start time in unit range.

    status: VideoStatus

    A read-only property that returns the status of provider. Suggested as a substitution for the existing getStatus()

    totalDuration: number

    Returns the duration of loaded video file in seconds, or zero if accessed during playback being in unprepared state.

    volume: number

    The audio volume of the video resource, normalized from 0 to 1.

    Methods

    • Returns the texture's aspect ratio, which is calculated as width / height.

      Returns number

    • Returns the number of times the video has played consecutively.

      Returns number

    • Returns the width of the texture in pixels.

      Returns number

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Pauses the video playback.

      Returns void

    • Plays the video playCount times. If playCount is less than 0, it loops infinitely.

      Parameters

      • playCount: number

      Returns void

    • Resumes the video playback.

      Returns void

    • Sets the current playback time to the specified time in seconds.

      Parameters

      • value: number

      Returns boolean

    • Sets callback as the function invoked when the video resource stops playing.

      Parameters

      • callback: () => void

      Returns void

    • Sets callback as the function invoked when the video resource is ready to be played.

      Parameters

      • onReadyCallback: () => void

      Returns void

    • Stops the video playback.

      Returns void

    MMNEPVFCICPMFPCPTTAAATR