Package com.wowza.wms.stream.publish
Class Stream
- Object
- 
- com.wowza.wms.stream.publish.Stream
 
- 
- All Implemented Interfaces:
- Runnable
 
 public class Stream extends Object implements Runnable
- 
- 
Constructor SummaryConstructors Constructor Description Stream()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(IStreamActionNotify listener)Add a listenerbooleanaddToPlaylist(int index, String name, int start, int length)Inserts a media source item to this playlist at a particular index, without interruption.booleanaddToPlaylist(String existing, String name, int start, int length)Insert item into playlist just after the first item in the playlist with a given name.voidclose()Call this method when you have finished with the playlist object.voidcloseAndWait()Call this method when you have finished with the playlist object.static StreamcreateInstance(IApplicationInstance appInstance, String sName)Use this to create a named Stream on an application instance.static StreamcreateInstance(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 StreamcreateInstance(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.static StreamcreateInstance(IVHost vhost, String applicationName, String appInstanceName, String sName, String streamType)Use this to create a named Stream on the non-default instance of an application on a particular VHost.PlaylistItemgetCurrentItem()Get the currently playing playlist itemObjectgetLock()Get the synchronization lock for this interface.StringgetName()Returns the name of the playlist stream - the client would play this stream by this name.java.util.List<PlaylistItem>getPlaylist()Get the current playlistintgetPollingInterval()Get the polling interval (milliseconds)PublishergetPublisher()booleangetRepeat()Use this to determine if the playlist is auto-repeatinglonggetStartLiveOnPreviousBufferTime()Get time in milliseconds to go back in live stream buffer to get previous key frameStringgetStreamType()intgetTimeOffsetBetweenItems()Get time in milliseconds to add to stream time between playlist items (default is zero)doublegetVODSpeed()booleanisMoveToNextIfLiveStreamMissing()If true, will move to next playlist item if live stream is missing or is unpublished.booleanisSendOnMetadata()True if sending onMetadata eventsbooleanisStartLiveOnPreviousKeyFrame()Set to true to start live streams on most recent key frame (smoother switching)booleanisSwitchLog()Log when a playlist switch occursbooleanisTimesInMilliseconds()If true start time and duration and are milliseconds.booleanisUnpublishOnEnd()If true, stop publishing if end of playlist and repeat is falsevoidnext()voidnext(int n)voidplay(int n)booleanplay(String sPlaylist)Add a media item to the playlist as defined by an XML file ..booleanplay(String name, int start, int length, boolean reset)Adds a media source item to this playlist -voidprevious()voidprevious(int n)booleanremoveFromPlaylist(int index)Remove item from playlist based on index.booleanremoveFromPlaylist(String name)Remove all items matching the given stream name from the playlist.voidremoveListener(IStreamActionNotify listener)Remove a listenervoidrun()Overridden from class Runnable ....voidsetMoveToNextIfLiveStreamMissing(boolean moveToNextIfLiveStreamMissing)If true, will move to next playlist item if live stream is missing or is unpublished.voidsetPollingInterval(int pollingInterval)Set the polling interval (milliseconds)voidsetRepeat(boolean repeat)Use this to make the playlist repeat or not...voidsetSendOnMetadata(boolean sendOnMetadata)True if sending onMetadata eventsvoidsetStartLiveOnPreviousBufferTime(long startLiveOnPreviousBufferTime)Set time in milliseconds to go back in live stream buffer to get previous key framevoidsetStartLiveOnPreviousKeyFrame(boolean startLiveOnPreviousKeyFrame)Set to true to start live streams on most recent key frame (smoother switching)voidsetSwitchLog(boolean switchLog)Log when a playlist switch occursvoidsetTimeOffsetBetweenItems(int timeOffsetBetweenItems)Set time in milliseconds to add to stream time between playlist items (default is zero)voidsetTimesInMilliseconds(boolean timesInMilliseconds)If true start time and duration and are milliseconds.voidsetUnpublishOnEnd(boolean stopOnEnd)If true, stop publishing if end of playlist and repeat is falsevoidsetVODSpeed(double vodSpeed)
 
- 
- 
- 
Field Detail- 
CLASSpublic static final Class<Stream> CLASS 
 - 
CLASSNAMEpublic static final String CLASSNAME - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
createInstancepublic 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
 
 - 
createInstancepublic 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
 
 - 
createInstancepublic static Stream createInstance(IVHost vhost, String applicationName, String appInstanceName, String sName, String streamType) 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
- streamType- - Stream type
- Returns:
- stream interface
 
 - 
getLockpublic Object getLock() Get the synchronization lock for this interface.- Returns:
- synchronization lock for this interface
 
 - 
createInstancepublic 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
 
 - 
runpublic void run() Overridden from class Runnable .... do NOT call this directly. This method handles switching between media sources in the playlist.- Specified by:
- runin interface- Runnable
 
 - 
getPlaylistpublic java.util.List<PlaylistItem> getPlaylist() Get the current playlist- Returns:
- current playlist
 
 - 
getCurrentItempublic PlaylistItem getCurrentItem() Get the currently playing playlist item- Returns:
- currently playing playlist item
 
 - 
playpublic 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.
 
 - 
addToPlaylistpublic 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
 
 - 
addToPlaylistpublic 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
 
 - 
removeFromPlaylistpublic boolean removeFromPlaylist(int index) Remove item from playlist based on index.- Parameters:
- index- item index
- Returns:
- true if at least one item from removed
 
 - 
removeFromPlaylistpublic 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
 
 - 
playpublic 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.
 
 - 
closepublic 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.
 - 
closeAndWaitpublic void closeAndWait() 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. This method will wait for the thread to exit.
 - 
getNamepublic 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
 
 - 
getRepeatpublic boolean getRepeat() Use this to determine if the playlist is auto-repeating- Returns:
- - true if repeating otherwise false.
 
 - 
setRepeatpublic void setRepeat(boolean repeat) Use this to make the playlist repeat or not...- Parameters:
- repeat- - true to repeat otherwise false
 
 - 
playpublic void play(int n) 
 - 
nextpublic void next(int n) 
 - 
nextpublic void next() 
 - 
previouspublic void previous() 
 - 
previouspublic void previous(int n) 
 - 
getPollingIntervalpublic int getPollingInterval() Get the polling interval (milliseconds)- Returns:
- polling interval (milliseconds)
 
 - 
setPollingIntervalpublic void setPollingInterval(int pollingInterval) Set the polling interval (milliseconds)- Parameters:
- pollingInterval- polling interval (milliseconds)
 
 - 
getPublisherpublic Publisher getPublisher() 
 - 
addListenerpublic void addListener(IStreamActionNotify listener) Add a listener- Parameters:
- listener- listener
 
 - 
removeListenerpublic void removeListener(IStreamActionNotify listener) Remove a listener- Parameters:
- listener- listener
 
 - 
isSwitchLogpublic boolean isSwitchLog() Log when a playlist switch occurs- Returns:
- log when a playlist switch occurs
 
 - 
setSwitchLogpublic void setSwitchLog(boolean switchLog) Log when a playlist switch occurs- Parameters:
- switchLog- log when a playlist switch occurs
 
 - 
isSendOnMetadatapublic boolean isSendOnMetadata() True if sending onMetadata events- Returns:
- True if sending onMetadata events
 
 - 
setSendOnMetadatapublic void setSendOnMetadata(boolean sendOnMetadata) True if sending onMetadata events- Parameters:
- sendOnMetadata- True if sending onMetadata events
 
 - 
isTimesInMillisecondspublic boolean isTimesInMilliseconds() If true start time and duration and are milliseconds. If false startTime and duration are in seconds.- Returns:
- true start time and duration and are milliseconds
 
 - 
setTimesInMillisecondspublic void setTimesInMilliseconds(boolean timesInMilliseconds) If true start time and duration and are milliseconds. If false startTime and duration are in seconds.- Parameters:
- timesInMilliseconds- true start time and duration and are milliseconds
 
 - 
isStartLiveOnPreviousKeyFramepublic boolean isStartLiveOnPreviousKeyFrame() Set to true to start live streams on most recent key frame (smoother switching)- Returns:
- true to start live streams on most recent key frame
 
 - 
setStartLiveOnPreviousKeyFramepublic void setStartLiveOnPreviousKeyFrame(boolean startLiveOnPreviousKeyFrame) Set to true to start live streams on most recent key frame (smoother switching)- Parameters:
- startLiveOnPreviousKeyFrame- true to start live streams on most recent key frame
 
 - 
getStartLiveOnPreviousBufferTimepublic long getStartLiveOnPreviousBufferTime() Get time in milliseconds to go back in live stream buffer to get previous key frame- Returns:
- time in milliseconds to go back in live stream buffer to get previous key frame
 
 - 
setStartLiveOnPreviousBufferTimepublic void setStartLiveOnPreviousBufferTime(long startLiveOnPreviousBufferTime) Set time in milliseconds to go back in live stream buffer to get previous key frame- Parameters:
- startLiveOnPreviousBufferTime- time in milliseconds to go back in live stream buffer to get previous key frame
 
 - 
getTimeOffsetBetweenItemspublic int getTimeOffsetBetweenItems() Get time in milliseconds to add to stream time between playlist items (default is zero)- Returns:
- time in milliseconds to add to stream time between playlist items
 
 - 
setTimeOffsetBetweenItemspublic void setTimeOffsetBetweenItems(int timeOffsetBetweenItems) Set time in milliseconds to add to stream time between playlist items (default is zero)- Parameters:
- timeOffsetBetweenItems- time in milliseconds to add to stream time between playlist items
 
 - 
isMoveToNextIfLiveStreamMissingpublic boolean isMoveToNextIfLiveStreamMissing() If true, will move to next playlist item if live stream is missing or is unpublished.- Returns:
- move to next playlist item if live stream is missing or is unpublished
 
 - 
setMoveToNextIfLiveStreamMissingpublic void setMoveToNextIfLiveStreamMissing(boolean moveToNextIfLiveStreamMissing) If true, will move to next playlist item if live stream is missing or is unpublished.- Parameters:
- moveToNextIfLiveStreamMissing- move to next playlist item if live stream is missing or is unpublished
 
 - 
isUnpublishOnEndpublic boolean isUnpublishOnEnd() If true, stop publishing if end of playlist and repeat is false- Returns:
- stop publishing if end of playlist and repeat is false
 
 - 
setUnpublishOnEndpublic void setUnpublishOnEnd(boolean stopOnEnd) If true, stop publishing if end of playlist and repeat is false- Parameters:
- stopOnEnd- stop publishing if end of playlist and repeat is false
 
 - 
getVODSpeedpublic double getVODSpeed() 
 - 
setVODSpeedpublic void setVODSpeed(double vodSpeed) 
 - 
getStreamTypepublic String getStreamType() 
 
- 
 
-