Class PlayEngine

java.lang.Object
org.red5.server.stream.PlayEngine
All Implemented Interfaces:
IConsumer, IFilter, IMessageComponent, IPipeConnectionListener, IProvider, IPushableConsumer

public final class PlayEngine extends Object implements IFilter, IPushableConsumer, IPipeConnectionListener
A play engine for playing a IPlayItem.
Author:
The Red5 Project, Steven Gong, Paul Gregoire (mondain@gmail.com), Dan Rossi, Tiago Daniel Jacobs (tiago@imdt.com.br), Vladimir Hmelyoff (vlhm@splitmedialabs.com)
  • Method Details

    • setBufferCheckInterval

      public void setBufferCheckInterval(int bufferCheckInterval)
    • setUnderrunTrigger

      public void setUnderrunTrigger(int underrunTrigger)
    • start

      public void start()
      Start stream
    • play

      Play stream
      Parameters:
      item - Playlist item
      Throws:
      StreamNotFoundException - Stream not found
      IllegalStateException - Stream is in stopped state
      IOException - Stream had io exception
    • play

      public void play(IPlayItem item, boolean withReset) throws StreamNotFoundException, IllegalStateException, IOException
      Play stream See: https://www.adobe.com/devnet/adobe-media-server/articles/dynstream_actionscript.html
      Parameters:
      item - Playlist item
      withReset - Send reset status before playing.
      Throws:
      StreamNotFoundException - Stream not found
      IllegalStateException - Stream is in stopped state
      IOException - Stream had IO exception
    • pause

      public void pause(int position) throws IllegalStateException
      Pause at position
      Parameters:
      position - Position in file
      Throws:
      IllegalStateException - If stream is stopped
    • resume

      public void resume(int position) throws IllegalStateException
      Resume playback
      Parameters:
      position - Resumes playback
      Throws:
      IllegalStateException - If stream is stopped
    • seek

      public void seek(int position) throws IllegalStateException, OperationNotSupportedException
      Seek to a given position
      Parameters:
      position - Position
      Throws:
      IllegalStateException - If stream is in stopped state
      OperationNotSupportedException - If this object doesn't support the operation.
    • stop

      public void stop() throws IllegalStateException
      Stop playback
      Throws:
      IllegalStateException - If stream is in stopped state
    • close

      public void close()
      Close stream
    • onOOBControlMessage

      public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg)
      Specified by:
      onOOBControlMessage in interface IMessageComponent
      Parameters:
      source - Message component source
      pipe - Connection pipe
      oobCtrlMsg - Out-of-band control message
    • onPipeConnectionEvent

      public void onPipeConnectionEvent(PipeConnectionEvent event)
      Pipe connection event handler
      Specified by:
      onPipeConnectionEvent in interface IPipeConnectionListener
      Parameters:
      event - Pipe connection event
    • pushMessage

      public void pushMessage(IPipe pipe, IMessage message) throws IOException
      Pushes message through pipe
      Specified by:
      pushMessage in interface IPushableConsumer
      Parameters:
      pipe - Pipe
      message - Message
      Throws:
      IOException - if message could not be written
    • isPullMode

      public boolean isPullMode()
    • isPaused

      public boolean isPaused()
    • getLastMessageTimestamp

      public int getLastMessageTimestamp()
      Returns the timestamp of the last message sent.
      Returns:
      last message timestamp
    • getPlaybackStart

      public long getPlaybackStart()
    • sendBlankAudio

      public void sendBlankAudio(boolean sendBlankAudio)
    • receiveAudio

      public boolean receiveAudio()
      Returns true if the engine currently receives audio.
      Returns:
      receive audio
    • receiveAudio

      public boolean receiveAudio(boolean receive)
      Returns true if the engine currently receives audio and sets the new value.
      Parameters:
      receive - new value
      Returns:
      old value
    • receiveVideo

      public boolean receiveVideo()
      Returns true if the engine currently receives video.
      Returns:
      receive video
    • receiveVideo

      public boolean receiveVideo(boolean receive)
      Returns true if the engine currently receives video and sets the new value.
      Parameters:
      receive - new value
      Returns:
      old value
    • checkSendMessageEnabled

      protected boolean checkSendMessageEnabled(RTMPMessage message)
      Check if sending the given message was enabled by the client.
      Parameters:
      message - the message to check
      Returns:
      true if the message should be sent, false otherwise (and the message is discarded)
    • setMaxPendingVideoFrames

      public void setMaxPendingVideoFrames(int maxPendingVideoFrames)
      Parameters:
      maxPendingVideoFrames - the maxPendingVideoFrames to set
    • setMaxSequentialPendingVideoFrames

      public void setMaxSequentialPendingVideoFrames(int maxSequentialPendingVideoFrames)
      Parameters:
      maxSequentialPendingVideoFrames - the maxSequentialPendingVideoFrames to set