com.smaxe.uv.client
Interface INetStream

All Known Implementing Classes:
NetStream

public interface INetStream

INetStream - RTMP connection stream (replica of ActionScript's NetStream class interface).

Version:
1.5.12
Author:
Andrei Sochirca
See Also:
JUV RTMP Client

Nested Class Summary
static interface INetStream.IListener
          IListener - NetStream listener.
static class INetStream.Info
          Info - INetStream stream info.
static class INetStream.ListenerAdapter
          ListenerAdapter - INetStream.IListener adapter.
 
Field Summary
static java.lang.String APPEND
          APPEND - "append" : publishes and records live data, appending the recorded data to an FLV file with a name that matches the value passed to the name parameter, stored on the server in a subdirectory within the directory that contains the server application.
static java.lang.String CLEAR_FAILED
          A recorded stream failed to delete.
static java.lang.String CLEAR_SUCCESS
          A recorded stream was deleted successfully.
static java.lang.String DATA_START
           
static java.lang.String FAILED
          An attempt to use a Stream method (at client-side) failed
static java.lang.String INVALID_ARGUMENT
          Invalid arguments were passed to a NetStream method.
static java.lang.String LIVE
          LIVE - "live" : publishes live data without recording it.
static java.lang.String PAUSE_NOTIFY
          The subscriber has used the seek command to move to a particular location in the recorded stream.
static java.lang.String PLAY_COMPLETE
          Playlist playback is complete.
static java.lang.String PLAY_FAILED
          An attempt to play back a stream failed
static java.lang.String PLAY_FILE_STRUCTURE_INVALID
          This event is sent if the player detects an MP4 with an invalid file structure.
static java.lang.String PLAY_INSUFFICIENT_BW
          Data is playing behind the normal speed
static java.lang.String PLAY_NO_SUPPORTED_TRACK_FOUND
          This event is sent if the player does not detect any supported tracks.
static java.lang.String PLAY_PUBLISH_NOTIFY
          The initial publish to a stream was successful.
static java.lang.String PLAY_RESET
          A playlist was reset
static java.lang.String PLAY_START
          Play was started
static java.lang.String PLAY_STOP
          Play was stopped
static java.lang.String PLAY_STREAM_NOT_FOUND
          An attempt was made to play a stream that does not exist
static java.lang.String PLAY_SWITCH
          Playlist playback switched from one stream to another.
static java.lang.String PLAY_UNPUBLISH_NOTIFY
          An unpublish from a stream was successful.
static java.lang.String PUBLISH_BADNAME
          An attempt was made to publish a stream that is already being published by someone else.
static java.lang.String PUBLISH_START
          An attempt to publish was successful.
static java.lang.String RECORD
          RECORD - "record" : publishes and records live data, saving the recorded data to a new FLV file with a name matching the value passed to the name parameter.
static java.lang.String RECORD_FAILED
          An attempt to record a stream failed
static java.lang.String RECORD_NOACCESS
          An attempt was made to record a read-only stream
static java.lang.String RECORD_START
          Recording was started
static java.lang.String RECORD_STOP
          Recording was stopped
static java.lang.String SEEK_FAILED
          The stream doesn't support seeking.
static java.lang.String SEEK_NOTIFY
          The subscriber has used the seek command to move to a particular location in the recorded stream.
static java.lang.String UNPAUSE_NOTIFY
          Publishing has stopped.
static java.lang.String UNPUBLISH_SUCCESS
          An attempt to unpublish was successful
 
Method Summary
 void addEventListener(INetStream.IListener listener)
          Registers an event listener.
 void attachAudio(IMicrophone microphone)
          Specifies an audio stream sent over the INetStream object, from a microphone object passed as the source.
 void attachCamera(ICamera camera, int snapshotMilliseconds)
          Starts capturing video from the specified source, or stops capturing if camera is set to null.
 double bufferLength()
          Returns number of seconds of data currently in the buffer.
 int bufferSize()
          Returns number of data bytes currently in the buffer.
 double bufferTime()
          Returns buffer time.
 void bufferTime(double time)
          Specifies how long to buffer messages before starting to display the stream.
 long bytesLoaded()
          Returns number of bytes of data that have been loaded.
 long bytesTotal()
          Returns total size (in bytes) of the file being loaded.
 int clearBuffer()
          Clears buffer.
 java.lang.Object client()
          Returns the object on which callback methods should be invoked.
 void client(java.lang.Object client)
          Sets the object on which callback methods should be invoked.
 void close()
          Stops playing all data on the stream, sets the time property to 0, and makes the stream available for another use.
 double currentFPS()
          Returns the number of frames per second being displayed.
 ICamera getCamera()
          Returns ICamera associated with the stream.
 INetStream.Info getInfo()
          Returns overall stream info.
 IMicrophone getMicrophone()
          Returns IMicrophone associated with the stream.
 IVideo getVideo()
          Returns IVideo associated with the stream.
 double liveDelay()
          Returns the number of seconds of data in the subscribing stream's buffer in live (unbuffered) mode.
 ObjectEncoding objectEncoding()
          Returns object encoding.
 void pause()
          Pauses playback of a video stream.
 void play(IVideo video, java.lang.Object... args)
          Begins playback of external audio or a video (FLV) file.
 void publish(java.lang.String name, java.lang.String type)
          Sends streaming audio, video, and text messages from a client to a server.
 void receiveAudio(boolean flag)
          Specifies whether incoming audio plays on the stream.
 void receiveVideo(boolean flag)
          Specifies whether incoming video plays on the stream.
 void removeEventListener(INetStream.IListener listener)
          Removes the listener.
 void resume()
          Resumes playback of a video stream that is paused.
 void seek(double offset)
          Seeks the keyframe closest to the specified location (an offset, in seconds, from the beginning of the stream).
 void send(java.lang.String handlerName, java.lang.Object... args)
          Sends a message on the specified stream to all subscribing clients.
 double time()
          Returns position of the playhead (in seconds).
 void togglePause()
          Pauses or resumes playback of a stream.
 

Field Detail

LIVE

static final java.lang.String LIVE
LIVE - "live" : publishes live data without recording it. If a file with a name that matches the value passed to the name parameter exists, it is deleted.

See Also:
Constant Field Values

RECORD

static final java.lang.String RECORD
RECORD - "record" : publishes and records live data, saving the recorded data to a new FLV file with a name matching the value passed to the name parameter. The file is stored on the server in a subdirectory within the directory that contains the server application. If the file already exists, it is overwritten.

See Also:
Constant Field Values

APPEND

static final java.lang.String APPEND
APPEND - "append" : publishes and records live data, appending the recorded data to an FLV file with a name that matches the value passed to the name parameter, stored on the server in a subdirectory within the directory that contains the server application. If no file with a matching name the name parameter is found, it is created.

See Also:
Constant Field Values

INVALID_ARGUMENT

static final java.lang.String INVALID_ARGUMENT
Invalid arguments were passed to a NetStream method.

See Also:
Constant Field Values

CLEAR_SUCCESS

static final java.lang.String CLEAR_SUCCESS
A recorded stream was deleted successfully.

See Also:
Constant Field Values

CLEAR_FAILED

static final java.lang.String CLEAR_FAILED
A recorded stream failed to delete.

See Also:
Constant Field Values

PUBLISH_START

static final java.lang.String PUBLISH_START
An attempt to publish was successful.

See Also:
Constant Field Values

PUBLISH_BADNAME

static final java.lang.String PUBLISH_BADNAME
An attempt was made to publish a stream that is already being published by someone else.

See Also:
Constant Field Values

FAILED

static final java.lang.String FAILED
An attempt to use a Stream method (at client-side) failed

See Also:
Constant Field Values

UNPUBLISH_SUCCESS

static final java.lang.String UNPUBLISH_SUCCESS
An attempt to unpublish was successful

See Also:
Constant Field Values

RECORD_START

static final java.lang.String RECORD_START
Recording was started

See Also:
Constant Field Values

RECORD_NOACCESS

static final java.lang.String RECORD_NOACCESS
An attempt was made to record a read-only stream

See Also:
Constant Field Values

RECORD_STOP

static final java.lang.String RECORD_STOP
Recording was stopped

See Also:
Constant Field Values

RECORD_FAILED

static final java.lang.String RECORD_FAILED
An attempt to record a stream failed

See Also:
Constant Field Values

PLAY_INSUFFICIENT_BW

static final java.lang.String PLAY_INSUFFICIENT_BW
Data is playing behind the normal speed

See Also:
Constant Field Values

PLAY_START

static final java.lang.String PLAY_START
Play was started

See Also:
Constant Field Values

PLAY_STREAM_NOT_FOUND

static final java.lang.String PLAY_STREAM_NOT_FOUND
An attempt was made to play a stream that does not exist

See Also:
Constant Field Values

PLAY_STOP

static final java.lang.String PLAY_STOP
Play was stopped

See Also:
Constant Field Values

PLAY_FAILED

static final java.lang.String PLAY_FAILED
An attempt to play back a stream failed

See Also:
Constant Field Values

PLAY_RESET

static final java.lang.String PLAY_RESET
A playlist was reset

See Also:
Constant Field Values

PLAY_PUBLISH_NOTIFY

static final java.lang.String PLAY_PUBLISH_NOTIFY
The initial publish to a stream was successful. This message is sent to all subscribers

See Also:
Constant Field Values

PLAY_UNPUBLISH_NOTIFY

static final java.lang.String PLAY_UNPUBLISH_NOTIFY
An unpublish from a stream was successful. This message is sent to all subscribers

See Also:
Constant Field Values

PLAY_SWITCH

static final java.lang.String PLAY_SWITCH
Playlist playback switched from one stream to another.

See Also:
Constant Field Values

PLAY_COMPLETE

static final java.lang.String PLAY_COMPLETE
Playlist playback is complete.

See Also:
Constant Field Values

SEEK_NOTIFY

static final java.lang.String SEEK_NOTIFY
The subscriber has used the seek command to move to a particular location in the recorded stream.

See Also:
Constant Field Values

SEEK_FAILED

static final java.lang.String SEEK_FAILED
The stream doesn't support seeking.

See Also:
Constant Field Values

PAUSE_NOTIFY

static final java.lang.String PAUSE_NOTIFY
The subscriber has used the seek command to move to a particular location in the recorded stream.

See Also:
Constant Field Values

UNPAUSE_NOTIFY

static final java.lang.String UNPAUSE_NOTIFY
Publishing has stopped.

See Also:
Constant Field Values

DATA_START

static final java.lang.String DATA_START
See Also:
Constant Field Values

PLAY_FILE_STRUCTURE_INVALID

static final java.lang.String PLAY_FILE_STRUCTURE_INVALID
This event is sent if the player detects an MP4 with an invalid file structure. Flash Player cannot play files that have invalid file structures. New for FMS3

See Also:
Constant Field Values

PLAY_NO_SUPPORTED_TRACK_FOUND

static final java.lang.String PLAY_NO_SUPPORTED_TRACK_FOUND
This event is sent if the player does not detect any supported tracks. If there aren't any supported video, audio or data tracks found, Flash Player does not play the file. New for FMS3

See Also:
Constant Field Values
Method Detail

bufferLength

double bufferLength()
Returns number of seconds of data currently in the buffer.

Returns:
number of seconds of data currently in the buffer

bufferSize

int bufferSize()
Returns number of data bytes currently in the buffer.

Returns:
number of data bytes currently in the buffer

bufferTime

double bufferTime()
Returns buffer time.

Returns:
buffer time

bufferTime

void bufferTime(double time)
Specifies how long to buffer messages before starting to display the stream.

Parameters:
time - buffer time

bytesLoaded

long bytesLoaded()
Returns number of bytes of data that have been loaded.

Returns:
number of bytes of data that have been loaded

bytesTotal

long bytesTotal()
Returns total size (in bytes) of the file being loaded.

Returns:
total size in bytes of the file being loaded

clearBuffer

int clearBuffer()
Clears buffer.

Returns:
cleared stream duration

client

void client(java.lang.Object client)
Sets the object on which callback methods should be invoked.

Parameters:
client -

client

java.lang.Object client()
Returns the object on which callback methods should be invoked.

Returns:
the object on which callback methods should be invoked

objectEncoding

ObjectEncoding objectEncoding()
Returns object encoding.

Returns:
object encoding

currentFPS

double currentFPS()
Returns the number of frames per second being displayed.

Returns:
number of frames per second being displayed

liveDelay

double liveDelay()
Returns the number of seconds of data in the subscribing stream's buffer in live (unbuffered) mode.

Returns:
number of seconds of data in the subscribing stream's buffer in live (unbuffered) mode

time

double time()
Returns position of the playhead (in seconds).

Returns:
position of the playhead, in seconds

attachAudio

void attachAudio(IMicrophone microphone)
Specifies an audio stream sent over the INetStream object, from a microphone object passed as the source.

Parameters:
microphone - source of the audio transmission

attachCamera

void attachCamera(ICamera camera,
                  int snapshotMilliseconds)
Starts capturing video from the specified source, or stops capturing if camera is set to null. This method is available only to the publisher of the specified stream.

Parameters:
camera - source of the video transmission
snapshotMilliseconds - Specifies whether the video stream is continuous, a single frame, or a series of single frames used to create time-lapse photography

close

void close()
Stops playing all data on the stream, sets the time property to 0, and makes the stream available for another use.


pause

void pause()
Pauses playback of a video stream.


play

void play(IVideo video,
          java.lang.Object... args)
Begins playback of external audio or a video (FLV) file.
 Note: 
 file parameter can be either string or object array:
 {name : Object [,start : Number[, len : Number[, reset : Object]]]}
 where
    start - An optional numeric parameter that specifies the
 start time, in seconds. This parameter can also be used to indicate whether
 the stream is live or recorded.
    The default value for start is -2, which means that it first tries to play
 the live stream specified in name. If a live stream of that name is not found,
 it plays the recorded stream specified in name. If neither a live nor a
 recorded stream is found, it opens a live stream named name, even
 though no one is publishing on it. When someone does begin publishing on
 that stream, it begins playing it.
    If you pass -1 for start, it plays only the live stream specified in name.
 If no live stream is found, it waits for it indefinitely if len is set to -1;
 if len is set to a different value, it waits for len seconds before it begins
 playing the next item in the playlist.
    If you pass 0 or a positive number for start, it plays only a recorded
 stream named name, beginning start seconds from the beginning of the stream.
 If no recorded stream is found, it begins playing the next item in the playlist
 immediately.
    If you pass a negative number other than -1 or -2 for start, it
 interprets the value as if it were -2.
 
    len - An optional numeric parameter that specifies the duration of the playback,
 in seconds.
    The default value for len is -1, which means that it plays a live stream
 until it is no longer available or plays a recorded stream until it ends.
    If you pass 0 for len, it plays the single frame that is start seconds
 from the beginning of a recorded stream (assuming start is equal to or greater than 0).
    If you pass a positive number for len, it plays a live stream for len seconds
 after it becomes available, or plays a recorded stream for len seconds.
 (If a stream ends before len seconds, playback ends when the stream ends.)
    If you pass a negative number other than -1 for len, it interprets the value
 as if it were -1.
 
    reset - An optional Boolean value or number that specifies whether to
 flush any previous playlist. If reset is false (0), name is added (queued)
 in the current playlist; that is, name plays only after previous streams
 finish playing. You can use this technique to create a dynamic playlist.
 If reset is true (1), any previous play calls are cleared and name is played
 immediately. By default, the value is true.

Parameters:
video - video object which received audio/video data
args - the location of the FLV file to play, as a URLRequest object or a string

publish

void publish(java.lang.String name,
             java.lang.String type)
Sends streaming audio, video, and text messages from a client to a server.

Parameters:
name - string that identifies the stream
type - string that specifies how to publish the stream. Valid values are "record", "append", and "live". The default value is "live".

receiveAudio

void receiveAudio(boolean flag)
Specifies whether incoming audio plays on the stream. This method is available only to clients subscribed to the specified stream, not to the stream's publisher.

Parameters:
flag - specifies whether incoming audio plays on the specified stream (true) or not (false)

receiveVideo

void receiveVideo(boolean flag)
Specifies whether incoming video plays on the stream. This method is available only to clients subscribed to the specified stream, not to the stream's publisher.

Parameters:
flag - specifies whether incoming video plays on the specified stream (true) or not (false)

resume

void resume()
Resumes playback of a video stream that is paused. If the video is already playing, calling this method does nothing.


seek

void seek(double offset)
Seeks the keyframe closest to the specified location (an offset, in seconds, from the beginning of the stream). The stream resumes playing when that location is reached.

Parameters:
offset - offset position

send

void send(java.lang.String handlerName,
          java.lang.Object... args)
Sends a message on the specified stream to all subscribing clients. This method is available only to the publisher of the specified stream.

Parameters:
handlerName -
args - optional arguments that can be of any type

togglePause

void togglePause()
Pauses or resumes playback of a stream. The first time you call this method, it pauses play; the next time, it resumes play. You could use this method to let users pause or resume playback by pressing a single button.


addEventListener

void addEventListener(INetStream.IListener listener)
Registers an event listener.

Parameters:
listener - listener to add

removeEventListener

void removeEventListener(INetStream.IListener listener)
Removes the listener.

Parameters:
listener - listener to remove

getInfo

INetStream.Info getInfo()
Returns overall stream info.

Returns:
overall stream info

getCamera

ICamera getCamera()
Returns ICamera associated with the stream.

Note:
- Camera is set by attachCamera(ICamera, int) method.

Returns:
camera

getMicrophone

IMicrophone getMicrophone()
Returns IMicrophone associated with the stream.

Note:
- Microphone is set by attachAudio(IMicrophone) method.

Returns:
microphone

getVideo

IVideo getVideo()
Returns IVideo associated with the stream.

Note:
- Video is set by play(IVideo, Object[]) method.

Returns:
video