public class PlaylistSubscriberStream extends AbstractClientStream implements IPlaylistSubscriberStream, IPlaylistSubscriberStreamStatistics
| Modifier and Type | Class and Description |
|---|---|
class |
PlaylistSubscriberStream.Notifier
Handles notifications in a separate thread.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferCheckInterval
Interval in ms to check for buffer underruns in VOD streams.
|
protected long |
bytesSent
Number of bytes sent.
|
protected long |
creationTime
Timestamp this stream was created.
|
protected PlayEngine |
engine
Plays items back
|
protected CopyOnWriteArraySet<String> |
jobs
Scheduled job names
|
protected boolean |
random
Random mode state
|
protected boolean |
repeat
Repeat mode state
|
protected boolean |
rewind
Rewind mode state
|
protected ISchedulingService |
schedulingService
Service used to provide notifications, keep client buffer filled, clean up, etc...
|
protected int |
underrunTrigger
Number of pending messages at which a
|
lock, startTime, stateMODE_APPEND, MODE_LIVE, MODE_PUBLISH, MODE_READ, MODE_RECORD| Constructor and Description |
|---|
PlaylistSubscriberStream()
Constructs a new PlaylistSubscriberStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(IPlayItem item)
Add an item to the list.
|
void |
addItem(IPlayItem item,
int index)
Add an item to specific index.
|
void |
cancelJob(String jobName)
Cancels a scheduled job by name.
|
void |
close()
Close this stream.
|
long |
getBytesSent()
Return total number of bytes sent to the client from this stream.
|
long |
getCreationTime()
Returns timestamp at which the stream was created.
|
IPlayItem |
getCurrentItem()
Get currently playing item
|
int |
getCurrentItemIndex()
Get currently playing item index.
|
int |
getCurrentTimestamp()
Return the currently active timestamp inside the stream.
|
double |
getEstimatedBufferFill()
Return estimated fill ratio of the client buffer.
|
IPlayItem |
getItem(int index)
Get the item according to the index.
|
int |
getItemSize()
Return number of items in list
|
IPlaylistSubscriberStreamStatistics |
getStatistics()
Return statistics about this stream.
|
boolean |
hasMoreItems()
Check if the playlist has more items after the currently playing one.
|
boolean |
isPaused()
Check if the stream is currently paused.
|
boolean |
isRandom()
Whether items are randomly played.
|
boolean |
isRepeat()
Whether repeat playing an item.
|
boolean |
isRewind()
Whether rewind the list.
|
void |
nextItem()
Go for next item decided by controller logic.
|
void |
onChange(StreamState state,
Object... changed)
Handles a change occurring on the stream.
|
void |
pause(int position)
Pause at a position for current playing item.
|
void |
play()
Start playing.
|
void |
previousItem()
Go for the previous played item.
|
void |
receiveAudio(boolean receive)
Should the stream send audio to the client?
|
void |
receiveVideo(boolean receive)
Should the stream send video to the client?
|
void |
removeAllItems()
Remove all items.
|
void |
removeItem(int index)
Remove an item from list.
|
boolean |
replace(IPlayItem oldItem,
IPlayItem newItem)
Replaces an item in the list with another item.
|
void |
resume(int position)
Resume from a position for current playing item.
|
String |
scheduleOnceJob(IScheduledJob job)
Schedule a job to be executed only once after a 10ms delay.
|
String |
scheduleWithFixedDelay(IScheduledJob job,
int interval)
Schedule a job to be executed regularly at the given interval.
|
void |
seek(int position)
Seek into a position for current playing item.
|
void |
setBufferCheckInterval(int bufferCheckInterval)
Set interval to check for buffer underruns.
|
void |
setItem(int index)
Set the current item for playing.
|
void |
setMaxPendingVideoFrames(int maxPendingVideoFrames) |
void |
setMaxSequentialPendingVideoFrames(int maxSequentialPendingVideoFrames) |
void |
setPlaylistController(IPlaylistController controller)
Set list controller.
|
void |
setRandom(boolean random)
Set whether items should be randomly played.
|
void |
setRepeat(boolean repeat)
Set whether repeat playing an item.
|
void |
setRewind(boolean rewind)
Set whether rewind the list.
|
void |
setUnderrunTrigger(int underrunTrigger)
Set maximum number of pending messages at which a
|
void |
start()
Start this stream.
|
void |
stop()
Stop playing.
|
getBroadcastStreamPublishName, getClientBufferDuration, getConnection, getStreamId, setBroadcastStreamPublishName, setClientBufferDuration, setConnection, setStreamIdaddStateChangeListener, fireStateChange, getCodecInfo, getMetaData, getName, getScope, getStartTime, getState, getStreamAwareHandler, removeStateChangeListener, setCodecInfo, setMetaData, setName, setScope, setStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetState, setStategetBroadcastStreamPublishName, getClientBufferDuration, getConnection, getStreamId, setBroadcastStreamPublishName, setClientBufferDurationgetCodecInfo, getName, getScope, getStartTimegetClientBufferDurationprotected PlayEngine engine
protected boolean rewind
protected boolean random
protected boolean repeat
protected ISchedulingService schedulingService
protected CopyOnWriteArraySet<String> jobs
protected int bufferCheckInterval
protected int underrunTrigger
NetStream.Play.InsufficientBWmessage is generated for VOD streams.
protected long creationTime
protected long bytesSent
public PlaylistSubscriberStream()
public void setBufferCheckInterval(int bufferCheckInterval)
bufferCheckInterval - interval in mspublic void setUnderrunTrigger(int underrunTrigger)
NetStream.Play.InsufficientBWmessage will be generated for VOD streams
underrunTrigger - the maximum number of pending messagespublic void play()
throws IOException
play in interface ISubscriberStreamIOException - if an IO error occurred while starting to play the streampublic void pause(int position)
pause in interface ISubscriberStreamposition - Position for pause in millisecond.public void resume(int position)
resume in interface ISubscriberStreamposition - Position for resume in millisecond.public void stop()
stop in interface IStreamstop in interface ISubscriberStreampublic void seek(int position)
throws OperationNotSupportedException
seek in interface ISubscriberStreamposition - Position for seek in millisecond.OperationNotSupportedException - if the stream doesn't support seeking.public boolean isPaused()
isPaused in interface ISubscriberStreampublic void addItem(IPlayItem item)
public void addItem(IPlayItem item, int index)
public void removeItem(int index)
removeItem in interface IPlaylistindex - Index in listpublic void removeAllItems()
removeAllItems in interface IPlaylistpublic void previousItem()
previousItem in interface IPlaylistpublic boolean hasMoreItems()
hasMoreItems in interface IPlaylisttrueif more items are available,
falseotherwise
public void nextItem()
public void setItem(int index)
public boolean isRandom()
public void setRandom(boolean random)
public boolean isRewind()
public void setRewind(boolean rewind)
public boolean isRepeat()
public void setRepeat(boolean repeat)
public void receiveVideo(boolean receive)
receiveVideo in interface ISubscriberStreamreceive - togglepublic void receiveAudio(boolean receive)
receiveAudio in interface ISubscriberStreamreceive - togglepublic void setPlaylistController(IPlaylistController controller)
setPlaylistController in interface IPlaylistcontroller - Playlist controllerpublic int getItemSize()
getItemSize in interface IPlaylistpublic int getCurrentItemIndex()
getCurrentItemIndex in interface IPlaylistpublic IPlayItem getCurrentItem()
getCurrentItem in interface IPlaylistpublic IPlayItem getItem(int index)
public boolean replace(IPlayItem oldItem, IPlayItem newItem)
replace in interface IPlaylistSubscriberStreamoldItem - old play itemnewItem - new play itempublic void onChange(StreamState state, Object... changed)
onChange in interface IPlaylistSubscriberStreamonChange in interface ISubscriberStreamstate - stream state that we are changing to or notifying ofchanged - changed itemspublic IPlaylistSubscriberStreamStatistics getStatistics()
getStatistics in interface IPlaylistSubscriberStreampublic long getCreationTime()
getCreationTime in interface IStatisticsBasegetCreationTime in interface IStreamgetCreationTime in class AbstractStreampublic int getCurrentTimestamp()
getCurrentTimestamp in interface IStreamStatisticspublic long getBytesSent()
getBytesSent in interface IPlaylistSubscriberStreamStatisticspublic double getEstimatedBufferFill()
getEstimatedBufferFill in interface IPlaylistSubscriberStreamStatisticspublic void setMaxPendingVideoFrames(int maxPendingVideoFrames)
maxPendingVideoFrames - the maxPendingVideoFrames to setpublic void setMaxSequentialPendingVideoFrames(int maxSequentialPendingVideoFrames)
maxSequentialPendingVideoFrames - the maxSequentialPendingVideoFrames to setpublic String scheduleOnceJob(IScheduledJob job)
scheduleOnceJob in interface ISubscriberStreamjob - scheduled jobpublic String scheduleWithFixedDelay(IScheduledJob job, int interval)
scheduleWithFixedDelay in interface ISubscriberStreamjob - scheduled jobinterval - intervalpublic void cancelJob(String jobName)
cancelJob in interface ISubscriberStreamjobName - job nameCopyright © 2005–2017 Red5. All rights reserved.