Package org.red5.server.stream
Class SingleItemSubscriberStream
java.lang.Object
org.red5.server.stream.AbstractStream
org.red5.server.stream.AbstractClientStream
org.red5.server.stream.SingleItemSubscriberStream
- All Implemented Interfaces:
IClientStream,ISingleItemSubscriberStream,IStream,ISubscriberStream
public class SingleItemSubscriberStream
extends AbstractClientStream
implements ISingleItemSubscriberStream
Stream of a single play item for a subscriber
- Author:
- Paul Gregoire (mondain@gmail.com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassHandles notifications in a separate thread. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intInterval in ms to check for buffer underruns in VOD streams.protected longTimestamp this stream was created.protected PlayEnginePlays items backScheduled job namesprotected ISchedulingServiceService used to provide notifications, keep client buffer filled, clean up, etc...protected intNumber of pending messages at which aFields inherited from class org.red5.server.stream.AbstractStream
codecInfo, metaData, startTime, state, stateListenersFields inherited from interface org.red5.server.api.stream.IClientStream
MODE_APPEND, MODE_LIVE, MODE_PUBLISH, MODE_READ, MODE_RECORD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCancels a scheduled job by name.voidclose()Close this stream.booleanisPaused()Check if the stream is currently paused.voidonChange(StreamState state, Object... changed) Notification of state change and associated parameters.voidpause(int position) Pause at a position for current playing item.voidplay()Start playing.voidreceiveAudio(boolean receive) Should the stream send audio to the client?voidreceiveVideo(boolean receive) Should the stream send video to the client?voidresume(int position) Resume from a position for current playing item.Schedule a job to be executed only once after a 10ms delay.scheduleWithFixedDelay(IScheduledJob job, int interval) Schedule a job to be executed regularly at the given interval.voidseek(int position) Seek into a position for current playing item.voidsetBufferCheckInterval(int bufferCheckInterval) Set interval to check for buffer underruns.voidsetPlayItem(IPlayItem item) Setter for property 'playItem'.voidsetUnderrunTrigger(int underrunTrigger) Set maximum number of pending messages at which avoidstart()Start this stream.voidstop()Stop playing.Methods inherited from class org.red5.server.stream.AbstractClientStream
getBroadcastStreamPublishName, getClientBufferDuration, getConnection, getStreamId, setBroadcastStreamPublishName, setClientBufferDuration, setConnection, setStreamId, setStreamIdMethods inherited from class org.red5.server.stream.AbstractStream
addStateChangeListener, fireStateChange, getCodecInfo, getCreationTime, getMetaData, getName, getScope, getStartTime, getState, getStreamAwareHandler, removeStateChangeListener, setCodecInfo, setMetaData, setName, setScope, setStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.red5.server.api.stream.IClientStream
getBroadcastStreamPublishName, getClientBufferDuration, getConnection, getStreamId, setBroadcastStreamPublishName, setClientBufferDurationMethods inherited from interface org.red5.server.api.stream.IStream
getCodecInfo, getCreationTime, getName, getScope, getStartTimeMethods inherited from interface org.red5.server.api.stream.ISubscriberStream
getState, setState
-
Field Details
-
schedulingService
Service used to provide notifications, keep client buffer filled, clean up, etc... -
jobs
Scheduled job names -
bufferCheckInterval
protected int bufferCheckIntervalInterval in ms to check for buffer underruns in VOD streams. -
underrunTrigger
protected int underrunTriggerNumber of pending messages at which aNetStream.Play.InsufficientBW
message is generated for VOD streams. -
creationTime
protected long creationTimeTimestamp this stream was created. -
engine
Plays items back
-
-
Constructor Details
-
SingleItemSubscriberStream
public SingleItemSubscriberStream()
-
-
Method Details
-
setPlayItem
Description copied from interface:ISingleItemSubscriberStreamSetter for property 'playItem'.- Specified by:
setPlayItemin interfaceISingleItemSubscriberStream- Parameters:
item- Value to set for property 'playItem'.
-
play
Description copied from interface:ISubscriberStreamStart playing.- Specified by:
playin interfaceISubscriberStream- Throws:
IOException- if an IO error occurred while starting to play the stream
-
pause
public void pause(int position) Pause at a position for current playing item.- Specified by:
pausein interfaceISubscriberStream- Parameters:
position- Position for pause in millisecond.
-
resume
public void resume(int position) Resume from a position for current playing item.- Specified by:
resumein interfaceISubscriberStream- Parameters:
position- Position for resume in millisecond.
-
stop
public void stop()Stop playing.- Specified by:
stopin interfaceIStream- Specified by:
stopin interfaceISubscriberStream
-
seek
Seek into a position for current playing item.- Specified by:
seekin interfaceISubscriberStream- Parameters:
position- Position for seek in millisecond.- Throws:
OperationNotSupportedException- if the stream doesn't support seeking.
-
isPaused
public boolean isPaused()Description copied from interface:ISubscriberStreamCheck if the stream is currently paused.- Specified by:
isPausedin interfaceISubscriberStream- Returns:
- stream is paused
-
receiveVideo
public void receiveVideo(boolean receive) Should the stream send video to the client?- Specified by:
receiveVideoin interfaceISubscriberStream- Parameters:
receive- toggle
-
receiveAudio
public void receiveAudio(boolean receive) Should the stream send audio to the client?- Specified by:
receiveAudioin interfaceISubscriberStream- Parameters:
receive- toggle
-
setBufferCheckInterval
public void setBufferCheckInterval(int bufferCheckInterval) Set interval to check for buffer underruns. Set to0
to disable.- Parameters:
bufferCheckInterval- interval in ms
-
setUnderrunTrigger
public void setUnderrunTrigger(int underrunTrigger) Set maximum number of pending messages at which aNetStream.Play.InsufficientBW
message will be generated for VOD streams- Parameters:
underrunTrigger- the maximum number of pending messages
-
start
public void start()Description copied from interface:IStreamStart this stream. -
close
public void close()Description copied from interface:IStreamClose this stream. -
onChange
Notification of state change and associated parameters.- Specified by:
onChangein interfaceISubscriberStream- Parameters:
state- new statechanged- parameters associated with the change
-
scheduleOnceJob
Schedule a job to be executed only once after a 10ms delay.- Specified by:
scheduleOnceJobin interfaceISubscriberStream- Parameters:
job- scheduled job- Returns:
- jobName
-
scheduleWithFixedDelay
Schedule a job to be executed regularly at the given interval.- Specified by:
scheduleWithFixedDelayin interfaceISubscriberStream- Parameters:
job- scheduled jobinterval- interval- Returns:
- jobName
-
cancelJob
Cancels a scheduled job by name.- Specified by:
cancelJobin interfaceISubscriberStream- Parameters:
jobName- job name
-