Class Stream

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

public class Stream extends Object implements Runnable
  • Field Details

  • Constructor Details

    • Stream

      public Stream()
  • Method Details

    • createInstance

      public static Stream createInstance(IVHost vhost, String applicationName, String streamName)
      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
      streamName - - Name of Stream
      Returns:
      stream interface
    • createInstance

      public static Stream createInstance(IVHost vhost, String applicationName, String appInstanceName, String streamName)
      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
      streamName - - Name of Stream
      Returns:
      stream interface
    • createInstance

      public static Stream createInstance(IVHost vhost, String applicationName, String appInstanceName, String streamName, 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
      streamName - - Name of Stream
      streamType - - Stream type
      Returns:
      stream interface
    • getLock

      public Object getLock()
      Get the synchronization lock for this interface.
      Returns:
      synchronization lock for this interface
    • 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
    • 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
    • getPlaylist

      public List<PlaylistItem> getPlaylist()
      Get the current playlist
      Returns:
      current playlist
    • getCurrentItem

      public PlaylistItem getCurrentItem()
      Get the currently playing playlist item
      Returns:
      currently playing playlist item
    • 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.
    • 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
    • removeFromPlaylist

      public boolean removeFromPlaylist(int index)
      Remove item from playlist based on index.
      Parameters:
      index - item index
      Returns:
      true if at least one item from removed
    • 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
    • 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.
    • 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.
    • closeAndWait

      public 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.
    • 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
    • getRepeat

      public boolean getRepeat()
      Use this to determine if the playlist is auto-repeating
      Returns:
      - true if repeating otherwise false.
    • setRepeat

      public void setRepeat(boolean repeat)
      Use this to make the playlist repeat or not...
      Parameters:
      repeat - - true to repeat otherwise false
    • play

      public void play(int index)
    • next

      public void next(int step)
    • next

      public void next()
    • previous

      public void previous()
    • previous

      public void previous(int step)
    • getPollingInterval

      public int getPollingInterval()
      Get the polling interval (milliseconds)
      Returns:
      polling interval (milliseconds)
    • setPollingInterval

      public void setPollingInterval(int pollingInterval)
      Set the polling interval (milliseconds)
      Parameters:
      pollingInterval - polling interval (milliseconds)
    • getPublisher

      public Publisher getPublisher()
    • addListener

      public void addListener(IStreamActionNotify listener)
      Add a listener
      Parameters:
      listener - listener
    • removeListener

      public void removeListener(IStreamActionNotify listener)
      Remove a listener
      Parameters:
      listener - listener
    • isSwitchLog

      public boolean isSwitchLog()
      Log when a playlist switch occurs
      Returns:
      log when a playlist switch occurs
    • setSwitchLog

      public void setSwitchLog(boolean switchLog)
      Log when a playlist switch occurs
      Parameters:
      switchLog - log when a playlist switch occurs
    • isSendOnMetadata

      public boolean isSendOnMetadata()
      True if sending onMetadata events
      Returns:
      True if sending onMetadata events
    • setSendOnMetadata

      public void setSendOnMetadata(boolean sendOnMetadata)
      True if sending onMetadata events
      Parameters:
      sendOnMetadata - True if sending onMetadata events
    • isTimesInMilliseconds

      public 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
    • setTimesInMilliseconds

      public 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
    • isStartLiveOnPreviousKeyFrame

      public 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
    • setStartLiveOnPreviousKeyFrame

      public 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
    • getStartLiveOnPreviousBufferTime

      public 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
    • setStartLiveOnPreviousBufferTime

      public 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
    • getTimeOffsetBetweenItems

      public 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
    • setTimeOffsetBetweenItems

      public 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
    • isMoveToNextIfLiveStreamMissing

      public 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
    • setMoveToNextIfLiveStreamMissing

      public 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
    • isUnpublishOnEnd

      public 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
    • setUnpublishOnEnd

      public 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
    • getVODSpeed

      public double getVODSpeed()
    • setVODSpeed

      public void setVODSpeed(double vodSpeed)
    • getStreamType

      public String getStreamType()