Package io.antmedia.muxer
Interface IAntMediaStreamHandler
- All Known Implementing Classes:
AntMediaApplicationAdapter
public interface IAntMediaStreamHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFrameListener(String streamId, IFrameListener listener) Add listener to get raw audio or video frames from the internal of Ant Media Server.booleanaddPacketListener(String streamId, IPacketListener listener) Add listener to get audio and video packets from the internal of Ant Media Server.voidAdd listener that is notified when the settings are updatedvoidaddStreamListener(IStreamListener listener) Add a stream listener to get notified when a new stream is started or finished.createCustomBroadcast(String streamId) Create another broadcast.createCustomBroadcast(String streamId, int height, int bitrate) Create another broadcast.Get the AppSettings of the applicationGet data channel router for data channel deliveryGet the DataStore of the applicationgetMuxAdaptor(String streamId) Get the MuxAdaptor of the stream.getScope()Get the scopebooleanbooleanisValidStreamParameters(int width, int height, int fps, int bitrate, String streamId) Checks a Stream parameters is valid.voidmuxAdaptorAdded(MuxAdaptor muxAdaptor) Adds a MuxAdaptor when a muxAdaptor is createdvoidmuxAdaptorRemoved(MuxAdaptor muxAdaptor) Removes a MuxAdaptor when a muxAdaptor is closingResourcesvoidmuxingFinished(Broadcast broadcast, String streamId, File file, long startTime, long duration, int resolution, String previewFilePath, String vodId) Called by some muxer like MP4Muxer id actually is the name of the file however in some cases file name and the id may be different in some cases like there is already a file with that namevoidnotifyWebhookForStreamStatus(Broadcast broadcast, int width, int height, long totalByteReceived, int inputQueueSize, int encodingQueueSize, int dropFrameCountInEncoding, int dropPacketCountInIngestion, double speed) Notify the webhook about the stream statusvoidremoveFrameListener(String streamId, IFrameListener listener) Remove frame listener from the Stream Handler to stop getting notifiedbooleanremovePacketListener(String streamId, IPacketListener listener) Remove listener from the Stream Handler to stop getting notifiedvoidremoveStreamListener(IStreamListener listener) Remove a stream listener from the Stream Handler to stop getting notifieddefault voidsetQualityParameters(String streamId, PublishStatsEvent stats, long currentTimeMillis) Sets quality parameters for the given stream ID.voidstartPublish(String streamId, long absoluteStartTimeMs, String publishType, String subscriberId, Map<String, String> publishParameters) Notify the handler that stream is started to publishvoidstopCustomBroadcast(String streamId) Stop the custom broadcast that is being created.voidstopPublish(String streamId, String subscriberId) Notify the handler that is stream is stoppedvoidNotify the handler that is stream is stoppedupdateBroadcastStatus(String streamId, long absoluteStartTimeMs, String publishType, Broadcast broadcast) Update broadcast status to BROADCASTING
-
Field Details
-
VERTX_BEAN_NAME
- See Also:
-
BROADCAST_STATUS_CREATED
- See Also:
-
BROADCAST_STATUS_BROADCASTING
- See Also:
-
BROADCAST_STATUS_FINISHED
- See Also:
-
BROADCAST_STATUS_PREPARING
- See Also:
-
BROADCAST_STATUS_ERROR
- See Also:
-
BROADCAST_STATUS_FAILED
- See Also:
-
BROADCAST_STATUS_TERMINATED_UNEXPECTEDLY
- See Also:
-
PUBLISH_TYPE_PULL
- See Also:
-
PUBLISH_TYPE_RTMP
- See Also:
-
PUBLISH_TYPE_WEBRTC
- See Also:
-
PUBLISH_TYPE_SRT
- See Also:
-
DEFAULT_USER_ROLE
- See Also:
-
WEBAPPS_PATH
- See Also:
-
-
Method Details
-
muxingFinished
void muxingFinished(Broadcast broadcast, String streamId, File file, long startTime, long duration, int resolution, String previewFilePath, String vodId) Called by some muxer like MP4Muxer id actually is the name of the file however in some cases file name and the id may be different in some cases like there is already a file with that name- Parameters:
broadcast- object that muxed is finishedstreamId- is the id of the streamfile- video file that muxed is finishedduration- of the video in millisecondsresolution- height of the videopreviewFilePath- path of the preview file
-
setQualityParameters
Sets quality parameters for the given stream ID. This method is called to update quality-related parameters for the specified stream during the publishing process.- Parameters:
streamId- The unique identifier of the stream.stats- The current publishing statistics for the stream.currentTimeMillis- The current timestamp in milliseconds.
-
muxAdaptorAdded
Adds a MuxAdaptor when a muxAdaptor is created- Parameters:
muxAdaptor-
-
muxAdaptorRemoved
Removes a MuxAdaptor when a muxAdaptor is closingResources- Parameters:
muxAdaptor-
-
isValidStreamParameters
Checks a Stream parameters is valid.- Parameters:
inputFormatContext- , pkt, streamId
-
isServerShuttingDown
boolean isServerShuttingDown()- Returns:
- true if server is shutting down
-
startPublish
void startPublish(String streamId, long absoluteStartTimeMs, String publishType, String subscriberId, Map<String, String> publishParameters) Notify the handler that stream is started to publish- Parameters:
streamId-absoluteStartTimeMs-publishType-subscriberId- : It's the id of the subscriber. It can be null if it's not available.
-
stopPublish
Notify the handler that is stream is stopped- Parameters:
streamId-subscriberId- : It's the id of the subscriber. It can be null if it's not available.
-
stopPublish
Notify the handler that is stream is stopped- Parameters:
streamId-subscriberId- : It's the id of the subscriber. It can be null if it's not available.publishParameters- : It's the parameters of the publish. It can be null if it's not available.
-
updateBroadcastStatus
Broadcast updateBroadcastStatus(String streamId, long absoluteStartTimeMs, String publishType, Broadcast broadcast) Update broadcast status to BROADCASTING- Parameters:
streamId- is the id of the stream.absoluteStartTimeMs- : It's the absolute start time if availablepublishType- : It's RTMP, WebRTC, StreamSourcebroadcast- : It's the broadcast object. If it's null, a new record will be created- Returns:
- broadcast object from database
-
addStreamListener
Add a stream listener to get notified when a new stream is started or finished.IStreamListenerinterface has callbacks for conference attendees. It's very useful to use in plugins.- Parameters:
listener-
-
removeStreamListener
Remove a stream listener from the Stream Handler to stop getting notified- Parameters:
listener-
-
addFrameListener
Add listener to get raw audio or video frames from the internal of Ant Media Server. The methods are called if the audio/video frames are decoded due to settings such adaptive bitrate etc.. This method does not force the Ant Media Server to decode the streams. 'Frame' is the decoded data of audio/video 'Packet'- Parameters:
streamId-listener-
-
removeFrameListener
Remove frame listener from the Stream Handler to stop getting notified- Parameters:
streamId-listener-
-
addPacketListener
Add listener to get audio and video packets from the internal of Ant Media Server. 'Packet' is the encoded data of audio/video 'Frame'.- Parameters:
streamId-listener-- Returns:
-
removePacketListener
Remove listener from the Stream Handler to stop getting notified- Parameters:
streamId-listener-- Returns:
-
createCustomBroadcast
Create another broadcast. It's useful to create another manipulated version of the original broadcast in the plugins. The returning frame listener should be feed with raw audio and video frames- Parameters:
streamId-- Returns:
-
createCustomBroadcast
Create another broadcast. It's useful to create another manipulated version of the original broadcast in the plugins. The returning frame listener should be feed with raw audio and video frames- Parameters:
streamId-height-bitrate-- Returns:
-
stopCustomBroadcast
Stop the custom broadcast that is being created. Stop encoders and make database operations.- Parameters:
streamId-
-
getMuxAdaptor
Get the MuxAdaptor of the stream. MuxAdaptor is the base class that is responsible for ingesting and distributing the stream- Parameters:
streamId-- Returns:
-
getAppSettings
AppSettings getAppSettings()Get the AppSettings of the application- Returns:
- AppSettings
-
getDataStore
DataStore getDataStore()Get the DataStore of the application- Returns:
- DataStore
-
getScope
IScope getScope()Get the scope- Returns:
-
notifyWebhookForStreamStatus
void notifyWebhookForStreamStatus(Broadcast broadcast, int width, int height, long totalByteReceived, int inputQueueSize, int encodingQueueSize, int dropFrameCountInEncoding, int dropPacketCountInIngestion, double speed) Notify the webhook about the stream status- Parameters:
streamName-absoluteStartTimeMs-
-
addSettingsUpdateListener
Add listener that is notified when the settings are updated- Parameters:
listener-
-
getDataChannelRouter
IDataChannelRouter getDataChannelRouter()Get data channel router for data channel delivery- Returns:
-