Package org.red5.server.stream
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)
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.red5.server.messaging.IPushableConsumer
KEY -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckSendMessageEnabled(RTMPMessage message) Check if sending the given message was enabled by the client.voidclose()Close streamintReturns the timestamp of the last message sent.longbooleanisPaused()booleanvoidonOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) voidPipe connection event handlervoidpause(int position) Pause at positionvoidPlay streamvoidPlay stream See: https://www.adobe.com/devnet/adobe-media-server/articles/dynstream_actionscript.htmlvoidpushMessage(IPipe pipe, IMessage message) Pushes message through pipebooleanReturns true if the engine currently receives audio.booleanreceiveAudio(boolean receive) Returns true if the engine currently receives audio and sets the new value.booleanReturns true if the engine currently receives video.booleanreceiveVideo(boolean receive) Returns true if the engine currently receives video and sets the new value.voidresume(int position) Resume playbackvoidseek(int position) Seek to a given positionvoidsendBlankAudio(boolean sendBlankAudio) voidsetBufferCheckInterval(int bufferCheckInterval) voidsetMaxPendingVideoFrames(int maxPendingVideoFrames) voidsetMaxSequentialPendingVideoFrames(int maxSequentialPendingVideoFrames) voidsetUnderrunTrigger(int underrunTrigger) voidstart()Start streamvoidstop()Stop playback
-
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 foundIllegalStateException- Stream is in stopped stateIOException- 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 itemwithReset- Send reset status before playing.- Throws:
StreamNotFoundException- Stream not foundIllegalStateException- Stream is in stopped stateIOException- Stream had IO exception
-
pause
Pause at position- Parameters:
position- Position in file- Throws:
IllegalStateException- If stream is stopped
-
resume
Resume playback- Parameters:
position- Resumes playback- Throws:
IllegalStateException- If stream is stopped
-
seek
Seek to a given position- Parameters:
position- Position- Throws:
IllegalStateException- If stream is in stopped stateOperationNotSupportedException- If this object doesn't support the operation.
-
stop
Stop playback- Throws:
IllegalStateException- If stream is in stopped state
-
close
public void close()Close stream -
onOOBControlMessage
- Specified by:
onOOBControlMessagein interfaceIMessageComponent- Parameters:
source- Message component sourcepipe- Connection pipeoobCtrlMsg- Out-of-band control message
-
onPipeConnectionEvent
Pipe connection event handler- Specified by:
onPipeConnectionEventin interfaceIPipeConnectionListener- Parameters:
event- Pipe connection event
-
pushMessage
Pushes message through pipe- Specified by:
pushMessagein interfaceIPushableConsumer- Parameters:
pipe- Pipemessage- 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
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
-