Scripting API

Home Scripting API Index Class Overview

com.nolimitscoaster

Class StreamedVideo


public final class StreamedVideo
extends Object

Similar to StreamedSound, a StreamedVideo is not completely loaded into memory, instead portions are loaded while played.

Method Summary

double getStreamingPosition()
  Returns the current position of the stream (in seconds).
bool isPlaying()
  Checks whether the stream is playing.
static StreamedVideo loadFromFile(String path)
  Create a streamed sound file using a file path
static StreamedVideo loadFromResource(ResourcePath path)
  Create a streamed video file using a resource path.
void play()
  Starts playback of video stream. Will automatically stop after video ended.
void playLoop()
  Starts playback of video stream. Will automatically restart after video ended.
void setAudioGain(float gain)
  Sets the audio's gain.
void stop()
  Stops playback of video stream.


Method Detail


getStreamingPosition

public double getStreamingPosition()

Returns the current position of the stream (in seconds).

Returns:
    Stream position in seconds, -1 when not playing.

Since:
    2.6.2.0


isPlaying

public bool isPlaying()

Checks whether the stream is playing.

Since:
    2.6.2.0


loadFromFile

public static StreamedVideo loadFromFile(String path)

Create a streamed sound file using a file path

path is relative to the classpath. The path should be a constant string expression so that the park package tool can detect used files. If the path is not a constant string expression, the compiler will show a warning and the file will not be detected by the package tool and will therefore not automatically be added to the park package. Will return null if path is null or the file could not be opened.


loadFromResource

public static StreamedVideo loadFromResource(ResourcePath path)

Create a streamed video file using a resource path.

The resource path can be obtained from Script.getResourcePathForId Will return null if the resource path is unknown or the video file could not be opened.


play

public void play()

Starts playback of video stream. Will automatically stop after video ended.


playLoop

public void playLoop()

Starts playback of video stream. Will automatically restart after video ended.


setAudioGain

public void setAudioGain(float gain)

Sets the audio's gain.

gain: 0..1


stop

public void stop()

Stops playback of video stream.