com.wowza.wms.stream.publish
Class Stream

Object
  extended by com.wowza.wms.stream.publish.Stream
All Implemented Interfaces:
Runnable

public class Stream
extends Object
implements Runnable


Constructor Summary
Stream()
           
 
Method Summary
 void addListener(IStreamActionNotify listener)
          Add a listener
 boolean addToPlaylist(int index, String name, int start, int length)
          Inserts a media source item to this playlist at a particular index, without interruption.
 boolean addToPlaylist(String existing, String name, int start, int length)
          Insert item into playlist just after the first item in the playlist with a given name.
 void close()
          Call this method when you have finished with the playlist object.
static Stream createInstance(IApplicationInstance appInstance, String sName)
          Use this to create a named Stream on an application instance.
static Stream createInstance(IVHost vhost, String applicationName, String sName)
          Use this to create a named Stream on the default instance (_definst_) of an application on a particular VHost.
static Stream createInstance(IVHost vhost, String applicationName, String appInstanceName, String sName)
          Use this to create a named Stream on the non-default instance of an application on a particular VHost.
 PlaylistItem getCurrentItem()
          Get the currently playing playlist item
 Object getLock()
          Get the synchronization lock for this interface.
 String getName()
          Returns the name of the playlist stream - the client would play this stream by this name.
 java.util.List<PlaylistItem> getPlaylist()
          Get the current playlist
 int getPollingInterval()
          Get the polling interval (milliseconds)
 Publisher getPublisher()
           
 boolean getRepeat()
          Use this to determine if the playlist is auto-repeating
 boolean isSendOnMetadata()
          True if sending onMetadata events
 boolean isSwitchLog()
          Log when a playlist switch occurs
 void next()
           
 void next(int n)
           
 void play(int n)
           
 boolean play(String sPlaylist)
          Add a media item to the playlist as defined by an XML file ..
 boolean play(String name, int start, int length, boolean reset)
          Adds a media source item to this playlist -
 void previous()
           
 void previous(int n)
           
 boolean removeFromPlaylist(String name)
          Remove all items matching the given stream name from the playlist.
 void removeListener(IStreamActionNotify listener)
          Remove a listener
 void run()
          Overridden from class Runnable ....
 void setPollingInterval(int pollingInterval)
          Set the polling interval (milliseconds)
 void setRepeat(boolean repeat)
          Use this to make the playlist repeat or not...
 void setSendOnMetadata(boolean sendOnMetadata)
          True if sending onMetadata events
 void setSwitchLog(boolean switchLog)
          Log when a playlist switch occurs
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stream

public Stream()
Method Detail

addListener

public void addListener(IStreamActionNotify listener)
Add a listener

Parameters:
listener - listener

addToPlaylist

public boolean addToPlaylist(int index,
                             String name,
                             int start,
                             int length)
Inserts a media source item to this playlist at a particular index, without interruption.

Parameters:
index - - insertion index
name - - name of media item being inserted
start - - where to start playing the item. (-2 implies play a live stream)
length - - how much of the item to play (-1 implies play the entire file or live stream)
Returns:
- returns true if item was inserted successfully ...otherwise false. this should not interrupt anything that might be currently playing.... will do nothing if existing item does not exist.. if existing == "" insert at head of list

addToPlaylist

public boolean addToPlaylist(String existing,
                             String name,
                             int start,
                             int length)
Insert item into playlist just after the first item in the playlist with a given name.

Parameters:
existing - name of playlist item in which to insert the item after
name - name of new item
start - where to start playing the item. (-2 implies play a live stream)
length - how much of the item to play (-1 implies play the entire file or live stream)
Returns:
true if item inserted

close

public void close()
Call this method when you have finished with the playlist object. It will terminate the playlist thread. The playlist object cannot be used after this call.


createInstance

public static Stream createInstance(IApplicationInstance appInstance,
                                    String sName)
Use this to create a named Stream on an application instance.

Parameters:
appInstance - - Application instance
sName - - Name of Stream
Returns:
stream interface

createInstance

public static Stream createInstance(IVHost vhost,
                                    String applicationName,
                                    String sName)
Use this to create a named Stream on the default instance (_definst_) of an application on a particular VHost.

Parameters:
vhost - - Virtual Host
applicationName - - Application name
sName - - Name of Stream
Returns:
stream interface

createInstance

public static Stream createInstance(IVHost vhost,
                                    String applicationName,
                                    String appInstanceName,
                                    String sName)
Use this to create a named Stream on the non-default instance of an application on a particular VHost.

Parameters:
vhost - - Virtual Host
applicationName - - Application name
appInstanceName - - Instance name
sName - - Name of Stream
Returns:
stream interface

getCurrentItem

public PlaylistItem getCurrentItem()
Get the currently playing playlist item

Returns:
currently playing playlist item

getLock

public Object getLock()
Get the synchronization lock for this interface.

Returns:
synchronization lock for this interface

getName

public String getName()
Returns the name of the playlist stream - the client would play this stream by this name.

Returns:
- the name of the playlist stream

getPlaylist

public java.util.List<PlaylistItem> getPlaylist()
Get the current playlist

Returns:
current playlist

getPollingInterval

public int getPollingInterval()
Get the polling interval (milliseconds)

Returns:
polling interval (milliseconds)

getPublisher

public Publisher getPublisher()

getRepeat

public boolean getRepeat()
Use this to determine if the playlist is auto-repeating

Returns:
- true if repeating otherwise false.

isSendOnMetadata

public boolean isSendOnMetadata()
True if sending onMetadata events

Returns:
True if sending onMetadata events

isSwitchLog

public boolean isSwitchLog()
Log when a playlist switch occurs

Returns:
log when a playlist switch occurs

next

public void next()

next

public void next(int n)

play

public void play(int n)

play

public boolean play(String sPlaylist)
Add a media item to the playlist as defined by an XML file ..

Parameters:
sPlaylist - - the playlist XML definition file
Returns:
- returns true if item was added successfully ...otherwise false.

play

public boolean play(String name,
                    int start,
                    int length,
                    boolean reset)
Adds a media source item to this playlist -

Parameters:
name - - name of media item
start - - where to start playing the item. (-2 implies play a live stream)
length - - how much of the item to play (-1 implies play the entire file or live stream)
reset - - if true, will begin a new playlist, otherwise items are appended
Returns:
- returns true if item was added successfully ...otherwise false.

previous

public void previous()

previous

public void previous(int n)

removeFromPlaylist

public boolean removeFromPlaylist(String name)
Remove all items matching the given stream name from the playlist. If the item is currently being played, it is not removed.

Parameters:
name - stream name
Returns:
true if at least one item from removed

removeListener

public void removeListener(IStreamActionNotify listener)
Remove a listener

Parameters:
listener - listener

run

public void run()
Overridden from class Runnable .... do NOT call this directly. This method handles switching between media sources in the playlist.

Specified by:
run in interface Runnable

setPollingInterval

public void setPollingInterval(int pollingInterval)
Set the polling interval (milliseconds)

Parameters:
pollingInterval - polling interval (milliseconds)

setRepeat

public void setRepeat(boolean repeat)
Use this to make the playlist repeat or not...

Parameters:
repeat - - true to repeat otherwise false

setSendOnMetadata

public void setSendOnMetadata(boolean sendOnMetadata)
True if sending onMetadata events

Parameters:
sendOnMetadata - True if sending onMetadata events

setSwitchLog

public void setSwitchLog(boolean switchLog)
Log when a playlist switch occurs

Parameters:
switchLog - log when a playlist switch occurs