Preparing search index...

    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)

    Index

    Properties

    autoplay: boolean

    Returns true if autoplay is enabled for this video texture.

    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. This value is applied when the video is loaded via VideoTextureProvider.load. To change the playback rate after loading, call VideoTextureProvider.unload first, set the new rate, then call VideoTextureProvider.load again. Defaults to 1.0.

    relativeEndTime: number

    The relative end time of playback in the range [0, 1], where 0 is the beginning and 1 is the end of the video. This value is applied when the video is loaded via VideoTextureProvider.load. To change after loading, call VideoTextureProvider.unload first, set the new value, then call VideoTextureProvider.load again. Defaults to 1.

    relativeStartTime: number

    The relative start time of playback in the range [0, 1], where 0 is the beginning and 1 is the end of the video. This value is applied when the video is loaded via VideoTextureProvider.load. To change after loading, call VideoTextureProvider.unload first, set the new value, then call VideoTextureProvider.load again. Defaults to 0.

    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. Can be changed dynamically during playback.

    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

    • Loads the video stream and stops on the first frame. Results in the video being in the Stopped state, ready to play. loopOnLoad If true, prepares the video for looped playback. If false, prepares for single playback. This may affect which decoder is used on some platforms.

      Parameters

      • loopOnLoad: boolean

      Returns void

      // Load video and stop on first frame
      var videoControl = videoTexture.control;
      videoControl.load(false); // Load for single playback
      // Wait for video to be ready
      videoControl.onPlaybackReady.add(function() {
      print("Video ready at first frame, Status=Stopped");
      // Now you can play it
      videoControl.play(1);
      });
      // Load video prepared for looping
      var videoControl = videoTexture.control;
      videoControl.load(true); // Load prepared for looping
      videoControl.onPlaybackReady.add(function() {
      videoControl.play(-1); // Play infinitely
      });
    • 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 and resets position to the beginning. Resources remain loaded. To resume playback, call play() again.

      Returns void

      // Stop video and reset to beginning
      var videoControl = videoTexture.control;
      videoControl.play(1);
      // ... later, stop the video
      videoControl.stop();
      // Video is now stopped at time 0 (status is VideoStatus.Stopped)
      // To play again, call play()
      videoControl.play(1);
    • Unloads the video and releases all resources.

      Returns void

      // Unload video to free resources
      var videoControl = videoTexture.control;
      videoControl.unload();
      // Video status is now VideoStatus.Unloaded