public interface RecorderEndpoint extends UriEndpoint
Provides the functionality to store contents. The recorder can store in local files or in a network resource. It receives a media stream from another MediaElement (i.e. the source), and stores it in the designated location.
The following information has to be provided In order to create a RecorderEndpoint, and cannot be changed afterwards:
file:///path/to/file
http(s)://{server-ip}/path/to/file
http(s)://username:password@{server-ip}/path/to/file
file:///var/lib/kurento/
RecorderEndpoint requires access to the resource where stream is going to be
recorded. If it's a local file (file://
), the system user running
the media server daemon (kurento by default), needs to have write permissions
for that URI. If it's an HTTP server, it must be accessible from the machine
where media server is running, and also have the correct access rights.
Otherwise, the media server won't be able to store any information, and an
ErrorEvent will be fired. Please note that if you haven't subscribed to that
type of event, you can be left wondering why your media is not being saved,
while the error message was ignored.
The media profile is quite an important parameter, as it will determine whether the server needs to perform on-the-fly transcoding of the media. If the input stream codec if not compatible with the selected media profile, the media will be transcoded into a suitable format. This will result in a higher CPU load and will impact overall performance of the media server.
For example: Say that your pipeline will receive VP8-encoded video from WebRTC, and sends it to a RecorderEndpoint; depending on the format selected...Recording will start as soon as the user invokes the record method. The recorder will then store, in the location indicated, the media that the source is sending to the endpoint's sink. If no media is being received, or no endpoint has been connected, then the destination will be empty. The recorder starts storing information into the file as soon as it gets it.
When another endpoint is connected to the recorder, by default both AUDIO and VIDEO media types are expected, unless specified otherwise when invoking the connect method. Failing to provide both types, will result in teh recording buffering the received media: it won't be written to the file until the recording is stopped. This is due to the recorder waiting for the other type of media to arrive, so they are synchronized.
The source endpoint can be hot-swapped, while the recording is taking place. The recorded file will then contain different feeds. When switching video sources, if the new video has different size, the recorder will retain the size of the previous source. If the source is disconnected, the last frame recorded will be shown for the duration of the disconnection, or until the recording is stopped.
It is recommended to start recording only after media arrives, either to the endpoint that is the source of the media connected to the recorder, to the recorder itself, or both. Users may use the MediaFlowIn and MediaFlowOut events, and synchronize the recording with the moment media comes in. In any case, nothing will be stored in the file until the first media packets arrive.
Stopping the recording process is done through the stopAndWait method, which will return only after all the information was stored correctly. If the file is empty, this means that no media arrived at the recorder.
Modifier and Type | Interface and Description |
---|---|
static class |
RecorderEndpoint.Builder |
addUriEndpointStateChangedListener, addUriEndpointStateChangedListener, getState, getState, getState, getUri, getUri, getUri, pause, pause, pause, removeUriEndpointStateChangedListener, removeUriEndpointStateChangedListener, stop, stop, stop
addElementConnectedListener, addElementConnectedListener, addElementDisconnectedListener, addElementDisconnectedListener, addMediaFlowInStateChangeListener, addMediaFlowInStateChangeListener, addMediaFlowOutStateChangeListener, addMediaFlowOutStateChangeListener, addMediaTranscodingStateChangeListener, addMediaTranscodingStateChangeListener, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, disconnect, getGstreamerDot, getGstreamerDot, getGstreamerDot, getGstreamerDot, getGstreamerDot, getGstreamerDot, getMaxOuputBitrate, getMaxOuputBitrate, getMaxOuputBitrate, getMaxOutputBitrate, getMaxOutputBitrate, getMaxOutputBitrate, getMinOuputBitrate, getMinOuputBitrate, getMinOuputBitrate, getMinOutputBitrate, getMinOutputBitrate, getMinOutputBitrate, getSinkConnections, getSinkConnections, getSinkConnections, getSinkConnections, getSinkConnections, getSinkConnections, getSinkConnections, getSinkConnections, getSinkConnections, getSourceConnections, getSourceConnections, getSourceConnections, getSourceConnections, getSourceConnections, getSourceConnections, getSourceConnections, getSourceConnections, getSourceConnections, getStats, getStats, getStats, getStats, getStats, getStats, isMediaFlowingIn, isMediaFlowingIn, isMediaFlowingIn, isMediaFlowingIn, isMediaFlowingIn, isMediaFlowingIn, isMediaFlowingOut, isMediaFlowingOut, isMediaFlowingOut, isMediaFlowingOut, isMediaFlowingOut, isMediaFlowingOut, isMediaTranscoding, isMediaTranscoding, isMediaTranscoding, isMediaTranscoding, isMediaTranscoding, isMediaTranscoding, removeElementConnectedListener, removeElementConnectedListener, removeElementDisconnectedListener, removeElementDisconnectedListener, removeMediaFlowInStateChangeListener, removeMediaFlowInStateChangeListener, removeMediaFlowOutStateChangeListener, removeMediaFlowOutStateChangeListener, removeMediaTranscodingStateChangeListener, removeMediaTranscodingStateChangeListener, setAudioFormat, setAudioFormat, setAudioFormat, setMaxOuputBitrate, setMaxOuputBitrate, setMaxOuputBitrate, setMaxOutputBitrate, setMaxOutputBitrate, setMaxOutputBitrate, setMinOuputBitrate, setMinOuputBitrate, setMinOuputBitrate, setMinOutputBitrate, setMinOutputBitrate, setMinOutputBitrate, setOutputBitrate, setOutputBitrate, setOutputBitrate, setVideoFormat, setVideoFormat, setVideoFormat
addErrorListener, addErrorListener, addTag, addTag, addTag, getChildren, getChildren, getChildren, getChilds, getChilds, getChilds, getCreationTime, getCreationTime, getCreationTime, getId, getId, getId, getMediaPipeline, getMediaPipeline, getMediaPipeline, getName, getName, getName, getParent, getParent, getParent, getSendTagsInEvents, getSendTagsInEvents, getSendTagsInEvents, getTag, getTag, getTag, getTags, getTags, getTags, removeErrorListener, removeErrorListener, removeTag, removeTag, removeTag, setName, setName, setName, setSendTagsInEvents, setSendTagsInEvents, setSendTagsInEvents
isCommited, release, release, release, waitCommited, whenCommited, whenCommited
void record()
void record(Continuation<Void> cont)
Continuation.onSuccess(F)
is called when the action is
done. If an error occurs, Continuation.onError(java.lang.Throwable)
is called.record()
void record(Transaction tx)
void stopAndWait()
void stopAndWait(Continuation<Void> cont)
Continuation.onSuccess(F)
is called when the action is
done. If an error occurs, Continuation.onError(java.lang.Throwable)
is called.stopAndWait()
void stopAndWait(Transaction tx)
ListenerSubscription addRecordingListener(EventListener<RecordingEvent> listener)
EventListener
for event RecordingEvent
. Synchronous call.listener
- Listener to be called on RecordingEventvoid addRecordingListener(EventListener<RecordingEvent> listener, Continuation<ListenerSubscription> cont)
EventListener
for event RecordingEvent
. Asynchronous call.
Calls Continuation<ListenerSubscription> when it has been added.listener
- Listener to be called on RecordingEventcont
- Continuation to be called when the listener is registeredvoid removeRecordingListener(ListenerSubscription listenerSubscription)
ListenerSubscription
for event RecordingEvent
. Synchronous call.listenerSubscription
- Listener subscription to be removedvoid removeRecordingListener(ListenerSubscription listenerSubscription, Continuation<Void> cont)
ListenerSubscription
for event RecordingEvent
. Asynchronous call.
Calls Continuation<Void> when it has been removed.listenerSubscription
- Listener subscription to be removedcont
- Continuation to be called when the listener is removedListenerSubscription addPausedListener(EventListener<PausedEvent> listener)
EventListener
for event PausedEvent
. Synchronous call.listener
- Listener to be called on PausedEventvoid addPausedListener(EventListener<PausedEvent> listener, Continuation<ListenerSubscription> cont)
EventListener
for event PausedEvent
. Asynchronous call.
Calls Continuation<ListenerSubscription> when it has been added.listener
- Listener to be called on PausedEventcont
- Continuation to be called when the listener is registeredvoid removePausedListener(ListenerSubscription listenerSubscription)
ListenerSubscription
for event PausedEvent
. Synchronous call.listenerSubscription
- Listener subscription to be removedvoid removePausedListener(ListenerSubscription listenerSubscription, Continuation<Void> cont)
ListenerSubscription
for event PausedEvent
. Asynchronous call.
Calls Continuation<Void> when it has been removed.listenerSubscription
- Listener subscription to be removedcont
- Continuation to be called when the listener is removedListenerSubscription addStoppedListener(EventListener<StoppedEvent> listener)
EventListener
for event StoppedEvent
. Synchronous call.listener
- Listener to be called on StoppedEventvoid addStoppedListener(EventListener<StoppedEvent> listener, Continuation<ListenerSubscription> cont)
EventListener
for event StoppedEvent
. Asynchronous call.
Calls Continuation<ListenerSubscription> when it has been added.listener
- Listener to be called on StoppedEventcont
- Continuation to be called when the listener is registeredvoid removeStoppedListener(ListenerSubscription listenerSubscription)
ListenerSubscription
for event StoppedEvent
. Synchronous call.listenerSubscription
- Listener subscription to be removedvoid removeStoppedListener(ListenerSubscription listenerSubscription, Continuation<Void> cont)
ListenerSubscription
for event StoppedEvent
. Asynchronous call.
Calls Continuation<Void> when it has been removed.listenerSubscription
- Listener subscription to be removedcont
- Continuation to be called when the listener is removedCopyright © 2019 Kurento. All rights reserved.