|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.red5.server.stream.AbstractStream
org.red5.server.stream.ServerStream
public class ServerStream
An implementation for server side stream.
Field Summary | |
---|---|
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. |
Fields inherited from class org.red5.server.stream.AbstractStream |
---|
creationTime, lock, metaData, state |
Fields inherited from interface org.red5.server.messaging.IPushableConsumer |
---|
KEY |
Constructor Summary | |
---|---|
ServerStream()
Constructs a new ServerStream. |
Method Summary | |
---|---|
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. |
CopyOnWriteArrayList<IPlayItem> |
getItems()
|
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 |
Methods inherited from class org.red5.server.stream.AbstractStream |
---|
getCodecInfo, getCreationTime, getMetaData, getName, getScope, getState, getStreamAwareHandler, setCodecInfo, setName, setScope, setState |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.red5.server.api.stream.IBroadcastStream |
---|
getMetaData |
Methods inherited from interface org.red5.server.api.stream.IStream |
---|
getCodecInfo, getCreationTime, getName, getScope |
Field Detail |
---|
protected String publishedName
protected IPlaylistController controller
protected IPlaylistController defaultController
protected CopyOnWriteArrayList<IPlayItem> items
protected IPlayItem currentItem
protected String recordingFilename
Constructor Detail |
---|
public ServerStream()
Method Detail |
---|
public void addItem(IPlayItem item)
addItem
in interface IPlaylist
item
- Playlist itempublic void addItem(IPlayItem item, int index)
addItem
in interface IPlaylist
item
- Playlist itemindex
- Index in listpublic 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 CopyOnWriteArrayList<IPlayItem> getItems()
public int getCurrentItemIndex()
getCurrentItemIndex
in interface IPlaylist
public IPlayItem getCurrentItem()
getCurrentItem
in interface IPlaylist
public IPlayItem getItem(int index)
getItem
in interface IPlaylist
index
- Item 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()
nextItem
in interface IPlaylist
public void setItem(int index)
setItem
in interface IPlaylist
index
- Position in listpublic boolean isRandom()
isRandom
in interface IPlaylist
true
if shuffle is on for this list, false
otherwisepublic void setRandom(boolean random)
setRandom
in interface IPlaylist
random
- Shuffle flagpublic boolean isRewind()
isRewind
in interface IPlaylist
true
if playlist is rewind on end, false
otherwisepublic void setRewind(boolean rewind)
setRewind
in interface IPlaylist
rewind
- New vallue for rewind flagpublic boolean isRepeat()
isRepeat
in interface IPlaylist
true
if repeat mode is on for this playlist, false
otherwisepublic void setRepeat(boolean repeat)
setRepeat
in interface IPlaylist
repeat
- New value for item playback repeat flagpublic 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 start()
start
in interface IStream
public void stop()
stop
in interface IStream
public void pause()
pause
in interface IServerStream
public void seek(int position)
seek
in interface IServerStream
position
- new playback position in millisecondspublic void close()
close
in interface IStream
public 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
- Message
IOException
- 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 remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |