Package io.antmedia.muxer
Interface IAntMediaStreamHandler
- All Known Implementing Classes:
AntMediaApplicationAdapter
public interface IAntMediaStreamHandler
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFrameListener
(String streamId, IFrameListener listener) Add listener to get raw audio or video frames from the internal of Ant Media Server.boolean
addPacketListener
(String streamId, IPacketListener listener) Add listener to get audio and video packets from the internal of Ant Media Server.void
Add listener that is notified when the settings are updatedvoid
addStreamListener
(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 the DataStore of the applicationgetMuxAdaptor
(String streamId) Get the MuxAdaptor of the stream.getScope()
Get the scopeboolean
boolean
isValidStreamParameters
(int width, int height, int fps, int bitrate, String streamId) Checks a Stream parameters is valid.void
muxAdaptorAdded
(MuxAdaptor muxAdaptor) Adds a MuxAdaptor when a muxAdaptor is createdvoid
muxAdaptorRemoved
(MuxAdaptor muxAdaptor) Removes a MuxAdaptor when a muxAdaptor is closingResourcesvoid
muxingFinished
(Broadcast broadcast, String streamId, File file, long startTime, long duration, int resolution, String path, 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 namevoid
muxingFinished
(String id, File file, long startTime, long duration, int resolution, String path, String vodId) Deprecated.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 statusvoid
removeFrameListener
(String streamId, IFrameListener listener) Remove frame listener from the Stream Handler to stop getting notifiedboolean
removePacketListener
(String streamId, IPacketListener listener) Remove listener from the Stream Handler to stop getting notifiedvoid
removeStreamListener
(IStreamListener listener) Remove a stream listener from the Stream Handler to stop getting notifieddefault void
setQualityParameters
(String streamId, PublishStatsEvent stats, long currentTimeMillis) Sets quality parameters for the given stream ID.void
setQualityParameters
(String streamId, String quality, double speed, int inputQueueSize, long currentTimeMillis) Deprecated.void
startPublish
(String streamName, long absoluteStartTimeMs, String publishType) Notify the handler that stream is started to publishvoid
stopCustomBroadcast
(String streamId) Stop the custom broadcast that is being created.void
stopPublish
(String streamId) Notify 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
@Deprecated void muxingFinished(String id, File file, long startTime, long duration, int resolution, String path, String vodId) Deprecated.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:
id
- is the name of the stream publishedfile
- video file that muxed is finishedduration
- of the video in millisecondsresolution
- height of the video
-
muxingFinished
void muxingFinished(Broadcast broadcast, String streamId, File file, long startTime, long duration, int resolution, String path, 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 video
-
setQualityParameters
@Deprecated void setQualityParameters(String streamId, String quality, double speed, int inputQueueSize, long currentTimeMillis) Deprecated.Update stream quality, speed and number of pending packet size and update time in datastore- Parameters:
id
- this is the id of the streamquality
- , quality of the stream values can be {@link MuxAdaptor#QUALITY_GOOD, MuxAdaptor#QUALITY_AVERAGE, MuxAdaptor#QUALITY_POOR, MuxAdaptor#QUALITY_NA}speed
- Speed of the stream. It should 1xpendingPacketSize
- Number of packets pending to be processedtotalByteReceived
-byteTransferred
-currentTimeMillis
-
-
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
Notify the handler that stream is started to publish- Parameters:
streamName
-absoluteStartTimeMs
-publishType
-
-
stopPublish
Notify the handler that is stream is stopped- Parameters:
streamId
-
-
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
- : @deprecated It's not used anymore. 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.IStreamListener
interface 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
-
-