public class ServerStream extends AbstractStream implements IServerStream, IFilter, IPushableConsumer, IPipeConnectionListener
Modifier and Type | Field and Description |
---|---|
protected IPlaylistController |
controller
Actual playlist controller
|
protected IPlayItem |
currentItem
Current item
|
protected IPlaylistController |
defaultController
Default playlist controller
|
protected CopyOnWriteArrayList<IPlayItem> |
items
List of items in this playlist
|
protected String |
publishedName
Stream published name
|
protected String |
recordingFilename
The filename we are recording to.
|
creationTime, metaData, state
KEY
Constructor and Description |
---|
ServerStream()
Constructs a new ServerStream.
|
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 |
addStreamListener(IStreamListener listener)
Add a listener to be notified about received packets.
|
void |
close()
Close this stream.
|
IPlayItem |
getCurrentItem()
Get currently playing item
|
int |
getCurrentItemIndex()
Get currently playing item index.
|
IPlayItem |
getItem(int index)
Get the item according to the index.
|
int |
getItemSize()
Return number of items in list
|
protected RTMPMessage |
getNextRTMPMessage()
Getter for next RTMP message.
|
IProvider |
getProvider()
Get the provider corresponding to this stream.
|
String |
getPublishedName()
Get stream publish name.
|
String |
getSaveFilename()
Get the filename the stream is being saved as.
|
Collection<IStreamListener> |
getStreamListeners()
Return registered stream listeners.
|
boolean |
hasMoreItems()
Check if the playlist has more items after the currently
playing one.
|
boolean |
isRandom()
Whether items are randomly played.
|
boolean |
isRepeat()
Whether repeat playing an item.
|
boolean |
isRewind()
Whether rewind the list.
|
protected void |
moveToNext()
Move to the next item updating the currentItemIndex.
|
protected void |
moveToPrevious()
Move to the previous item updating the currentItemIndex.
|
void |
nextItem()
Go for next item decided by controller logic.
|
protected void |
notifyBroadcastClose()
Notifies handler on stream broadcast stop
|
protected void |
notifyBroadcastStart()
Notifies handler on stream broadcast start
|
protected void |
onItemEnd()
Play next item on item end
|
void |
onOOBControlMessage(IMessageComponent source,
IPipe pipe,
OOBControlMessage oobCtrlMsg) |
void |
onPipeConnectionEvent(PipeConnectionEvent event)
Pipe connection event handler.
|
void |
pause()
Toggles the paused state.
|
protected void |
play(IPlayItem item)
Play a specific IPlayItem.
|
void |
previousItem()
Go for the previous played item.
|
void |
pushMessage(IPipe pipe,
IMessage message)
Pushes message through pipe
|
void |
removeAllItems()
Remove all items.
|
void |
removeItem(int index)
Remove an item from list.
|
void |
removeStreamListener(IStreamListener listener)
Remove a listener from being notified about received packets.
|
void |
saveAs(String name,
boolean isAppend)
Save the broadcast stream as a file.
|
protected void |
scheduleNextMessage()
Pull the next message from IMessageInput and schedule
it for push according to the timestamp.
|
void |
seek(int position)
Seek to a given position in the stream.
|
void |
setItem(int index)
Set the current item for playing.
|
void |
setPlaylistController(IPlaylistController controller)
Set list controller.
|
void |
setPublishedName(String name) |
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 |
start()
Start this server-side stream
|
protected void |
startBroadcastVOD()
Begin VOD broadcasting
|
void |
stop()
Stop this server-side stream
|
getCodecInfo, getCreationTime, getMetaData, getName, getScope, getStreamAwareHandler, setCodecInfo, setName, setScope
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetaData
getCodecInfo, getCreationTime, getName, getScope
protected String publishedName
protected IPlaylistController controller
protected IPlaylistController defaultController
protected CopyOnWriteArrayList<IPlayItem> items
protected IPlayItem currentItem
protected String recordingFilename
public void addItem(IPlayItem item)
public void addItem(IPlayItem item, int index)
public void removeItem(int index)
removeItem
in interface IPlaylist
index
- Index in listpublic void removeAllItems()
removeAllItems
in interface IPlaylist
public int getItemSize()
getItemSize
in interface IPlaylist
public int getCurrentItemIndex()
getCurrentItemIndex
in interface IPlaylist
public IPlayItem getCurrentItem()
getCurrentItem
in interface IPlaylist
public IPlayItem getItem(int index)
public void previousItem()
previousItem
in interface IPlaylist
public boolean hasMoreItems()
hasMoreItems
in interface IPlaylist
true
if more items are available, false
otherwisepublic 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 setPlaylistController(IPlaylistController controller)
setPlaylistController
in interface IPlaylist
controller
- Playlist controllerpublic void saveAs(String name, boolean isAppend) throws IOException, ResourceNotFoundException, ResourceExistException
saveAs
in interface IBroadcastStream
name
- The path of the file relative to the scope.isAppend
- Whether to append to the end of file.IOException
- File could not be created/written to.ResourceNotFoundException
- Resource not exist when trying to append.ResourceExistException
- Resource exist when trying to create.public String getSaveFilename()
getSaveFilename
in interface IBroadcastStream
null
if the stream is not being saved.public IProvider getProvider()
getProvider
in interface IBroadcastStream
public String getPublishedName()
NetStream.publish
on client side in
SWF.getPublishedName
in interface IBroadcastStream
public void setPublishedName(String name)
setPublishedName
in interface IBroadcastStream
name
- Set stream publish namepublic void pause()
pause
in interface IServerStream
public void seek(int position)
seek
in interface IServerStream
position
- new playback position in millisecondspublic void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg)
onOOBControlMessage
in interface IMessageComponent
source
- Message component sourcepipe
- Connection pipeoobCtrlMsg
- Out-of-band control messagepublic void pushMessage(IPipe pipe, IMessage message) throws IOException
pushMessage
in interface IPushableConsumer
pipe
- Pipemessage
- MessageIOException
- if message could not be writtenpublic void onPipeConnectionEvent(PipeConnectionEvent event)
onPipeConnectionEvent
in interface IPipeConnectionListener
event
- Pipe connection event contextprotected void play(IPlayItem item)
item
- Item to playprotected void onItemEnd()
protected void startBroadcastVOD()
protected void notifyBroadcastClose()
protected void notifyBroadcastStart()
protected void scheduleNextMessage()
protected RTMPMessage getNextRTMPMessage()
protected void moveToNext()
protected void moveToPrevious()
public void addStreamListener(IStreamListener listener)
IBroadcastStream
addStreamListener
in interface IBroadcastStream
listener
- the listener to addpublic Collection<IStreamListener> getStreamListeners()
IBroadcastStream
getStreamListeners
in interface IBroadcastStream
public void removeStreamListener(IStreamListener listener)
IBroadcastStream
removeStreamListener
in interface IBroadcastStream
listener
- the listener to removeCopyright © 2006-2012 The Red5 Project