Package io.antmedia
Class AntMediaApplicationAdapter
java.lang.Object
org.red5.server.adapter.AbstractScopeAdapter
org.red5.server.adapter.StatefulScopeWrappingAdapter
org.red5.server.adapter.MultiThreadedApplicationAdapter
io.antmedia.AntMediaApplicationAdapter
- All Implemented Interfaces:
IAntMediaStreamHandler
,IShutdownListener
,IEventHandler
,IAttributeStore
,ISchedulingService
,IScopeAware
,IScopeHandler
,IScopeService
,IBroadcastStreamService
,IOnDemandStreamService
,IStreamSecurityService
,ISubscriberStreamService
,IStreamAwareScopeHandler
,ApplicationMXBean
,AttributeStoreMXBean
public class AntMediaApplicationAdapter
extends MultiThreadedApplicationAdapter
implements IAntMediaStreamHandler, IShutdownListener
-
Field Summary
Modifier and TypeFieldDescriptionprivate AppSettings
static final String
static final int
static final int
static final int
private IClusterNotifier
(package private) IClusterStreamFetcher
private DataStore
private DataStoreFactory
static final String
protected static final int
static final String
static final String
static final String
static final String
This is used to notify that the first active subtrack is created in the main track In video conferencing, it means the first stream is started in the roomstatic final String
This is used to notify that there is no active subtracks left in the main track.static final String
This is used to notify that the play is startedstatic final String
This is used to notify that the play is stoppedstatic final String
static final String
static final String
static final String
This is used to notify that the subtrack is created in the main track In video conferencing, it means a stream is started in the roomstatic final String
This is used to notify that the subtrack left the main track In video conferencing, it means a stream left the roomstatic final String
static final String
static final String
protected static org.slf4j.Logger
protected Map<String,
MuxAdaptor> private int
private Map<String,
OnvifCamera> static final String
protected int
private Random
private ServerSettings
protected boolean
private Set<IAppSettingsUpdateListener>
private boolean
private IStatsCollector
protected StorageClient
static final String
static final int
Timeout value that stream is considered as finished or stuckprivate StreamAcceptFilter
protected StreamFetcherManager
protected Queue<IStreamListener>
private List<IStreamPublishSecurity>
static final String
protected ISubtrackPoller
private io.vertx.core.Vertx
static final String
private static final String
protected WebRTCAudioReceiveStats
protected WebRTCAudioSendStats
protected WebRTCVideoReceiveStats
protected WebRTCVideoSendStats
Fields inherited from class org.red5.server.adapter.MultiThreadedApplicationAdapter
log, schedulingService
Fields inherited from class org.red5.server.adapter.StatefulScopeWrappingAdapter
plugins, scope
Fields inherited from interface io.antmedia.muxer.IAntMediaStreamHandler
BROADCAST_STATUS_BROADCASTING, BROADCAST_STATUS_CREATED, BROADCAST_STATUS_ERROR, BROADCAST_STATUS_FAILED, BROADCAST_STATUS_FINISHED, BROADCAST_STATUS_PREPARING, BROADCAST_STATUS_TERMINATED_UNEXPECTEDLY, DEFAULT_USER_ROLE, PUBLISH_TYPE_PULL, PUBLISH_TYPE_RTMP, PUBLISH_TYPE_SRT, PUBLISH_TYPE_WEBRTC, VERTX_BEAN_NAME, WEBAPPS_PATH
Fields inherited from interface org.red5.server.api.service.IBroadcastStreamService
BROADCAST_STREAM_SERVICE
-
Constructor Summary
-
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.boolean
Called once on scope (that is, application or application room) start.void
Handler method.boolean
callClusterRestMethod
(String url, String clusterCommunicationToken) void
cancelPlaylistSchedule
(String streamId) void
closeBroadcast
(String streamId) void
closeDB
(boolean deleteDB) void
void
createCustomBroadcast
(String streamId) Create another broadcast.createCustomBroadcast
(String streamId, int height, int bitrate) Create another broadcast.void
createInitializationFile
(String appName, Result result, File initializedFile) createInitializationProcess
(String appName) void
createShutdownFile
(String appName) createSymbolicLink
(File streamsFolder, File vodFolder) boolean
deleteSymbolicLink
(File vodDirectory, File streamsFolder) Deletes the symbolic link under the streams directoryprivate int
deleteUserVoDByStreamId
(String streamId) boolean
doesWebRTCStreamExist
(String streamId) void
encoderBlocked
(String streamId, boolean blocked) void
endpointFailedUpdate
(String streamId, String url) void
forwardStartStreaming
(Broadcast broadcast) private int
Get the AppSettings of the applicationGet the DataStore of the applicationorg.apache.http.impl.client.CloseableHttpClient
getListenerHookURL
(Broadcast broadcast) getMuxAdaptor
(String streamId) Get the MuxAdaptor of the stream.int
int
Number of encoders blocked.int
getOnvifCamera
(String id) static String
getRelativePath
(String filePath) getRTMPToWebRTCStats
(String streamId) io.vertx.core.Vertx
getVertx()
int
importToDB
(File subDirectory, File baseDirectory) importVoDFolder
(String vodFolderPath) Import vod files recursively in the directory.void
incrementEncoderNotOpenedError
(String streamId) boolean
boolean
boolean
private boolean
isEncoderSettingsValid
(List<EncoderSettings> encoderSettingsList) static boolean
isEndpointReachable
(String endpoint) boolean
isIncomingSettingsDifferent
(AppSettings newSettings) static boolean
isInstanceAlive
(String originAdress, String hostAddress, int httpPort, String appName) boolean
boolean
static final boolean
isStreaming
(String status) Important information: Status field of Broadcast class checks the update time to report the status is broadcasting or not.private boolean
isTokenSecuritySettingsValid
(AppSettings newSettings) boolean
isValidStreamParameters
(int width, int height, int fps, int bitrate, String streamId) Checks a Stream parameters is valid.void
joinedTheRoom
(String roomId, String streamId) void
leftTheRoom
(String mainTrackId, String subtrackId) 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 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 namevoid
muxingFinished
(String streamId, File File, long startTime, long duration, int resolution, String previewFilePath, String vodId) Deprecated.void
notifyFirstActiveSubtrackInMainTrack
(Broadcast mainTrack, String subtrackId) void
notifyHook
(@NotNull String url, String id, String mainTrackId, String action, String streamName, String category, String vodName, String vodId, String metadata, String subscriberId) Notify hook with parameters belowvoid
notifyNoActiveSubtracksLeftInMainTrack
(Broadcast mainTrack) void
notifySettingsUpdateListeners
(AppSettings appSettings) 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
publishTimeoutError
(String streamId, String subscriberId) private void
void
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 notifiedThis method is called after ungraceful shutdownvoid
resetDASHStats
(String streamId) void
resetHLSStats
(String streamId) void
retrySendPostWithDelay
(String url, Map<String, Object> variables, int retryAttempts, String contentType) void
static Broadcast
saveMainBroadcast
(String streamId, String mainTrackId, DataStore dataStore) static Broadcast
saveUndefinedBroadcast
(String streamId, String streamName, AntMediaApplicationAdapter appAdapter, String streamStatus, long absoluteStartTimeMs, String publishType, String mainTrackStreamId, String metaData, String role) void
schedulePlayList
(long now, Broadcast broadcast) boolean
sendClusterPost
(String url, String clusterCommunicationToken) boolean
sendDataChannelMessage
(String streamId, String message) void
void
sendWebHook
(String id, String mainTrackId, String action, String streamName, String category, String vodName, String vodId, String metadata, String subscriberId) void
void
setAppSettings
(AppSettings appSettings) static boolean
setAppSettingsFieldValue
(AppSettings appSettings, AppSettings newSettings, Field field) void
setClusterNotifier
(IClusterNotifier clusterNotifier) void
setDataStore
(DataStore dataStore) void
setDataStoreFactory
(DataStoreFactory dataStoreFactory) void
setQualityParameters
(String streamId, PublishStatsEvent stats, long currentTimeMillis) Sets quality parameters for the given stream ID.void
setQualityParameters
(String id, String quality, double speed, int pendingPacketSize, long updateTimeMs) Update stream quality, speed and number of pending packet size and update time in datastorevoid
setServerSettings
(ServerSettings serverSettings) void
setShutdownProperly
(boolean shutdownProperly) void
setStatsCollector
(IStatsCollector statsCollector) void
setStorageClient
(StorageClient storageClient) void
setStorageclientSettings
(AppSettings settings) void
setStreamAcceptFilter
(StreamAcceptFilter streamAcceptFilter) void
setStreamFetcherManager
(StreamFetcherManager streamFetcherManager) void
setStreamPublishSecurityList
(List<IStreamPublishSecurity> streamPublishSecurityList) void
setSubtrackPoller
(ISubtrackPoller subtrackPoller) void
setVertx
(io.vertx.core.Vertx vertx) This setter for test casesstartHttpSignaling
(PublishParameters publishParameters, String sdp, String sessionId) void
startPublish
(String streamId, long absoluteStartTimeMs, String publishType) Notify the handler that stream is started to publishstartStreaming
(Broadcast broadcast) void
stopApplication
(boolean deleteDB) void
stopCustomBroadcast
(String streamId) Stop the custom broadcast that is being created.boolean
stopPlaying
(String viewerId) boolean
stopPlayingBySubscriberId
(String subscriberId) void
stopPublish
(String streamId) Notify the handler that is stream is stoppedboolean
stopPublishingBySubscriberId
(String subscriberId) stopStreaming
(Broadcast broadcast, boolean stopSubtracks) stopWhipBroadcast
(String streamId, String sessionId) void
streamPlayItemPlay
(ISubscriberStream stream, IPlayItem item, boolean isLive) Notified when a play item plays.void
streamPlayItemStop
(ISubscriberStream stream, IPlayItem item) Notified when a play item stops.void
Notified when a subscriber closes.boolean
synchUserVoDFolder
(String oldFolderPath, String vodFolderPath) void
trySendClusterPostWithDelay
(String url, String clusterCommunicationToken, int retryAttempts, CompletableFuture<Boolean> future) unlinksVoD
(String directory) void
updateAppSettingsBean
(AppSettings appSettings, AppSettings newSettings, boolean updateTime) static boolean
updateAppSettingsFile
(String appName, AppSettings newAppsettings) updateBroadcastStatus
(String streamId, long absoluteStartTimeMs, String publishType, Broadcast broadcast) Update broadcast status to BROADCASTINGupdateBroadcastStatus
(String streamId, long absoluteStartTimeMs, String publishType, Broadcast broadcast, String status) void
updateMainTrackWithRecentlyFinishedBroadcast
(Broadcast finishedBroadcast) If multiple threads enter the method at the same time, the following method does not work correctly.boolean
updateSettings
(AppSettings newSettings, boolean notifyCluster, boolean checkUpdateTime) void
void
Methods inherited from class org.red5.server.adapter.MultiThreadedApplicationAdapter
addListener, addScheduledJob, addScheduledJobAfterDelay, addScheduledOnceJob, addScheduledOnceJob, appConnect, appDisconnect, appJoin, appLeave, connect, connect, disconnect, FCPublish, FCSubscribe, FCUnpublish, FCUnpublish, getBroadcastStream, getBroadcastStreamNames, getClientTTL, getGhostConnsCleanupPeriod, getListeners, getOnDemandStream, getScheduledJobNames, getStreamLength, getStreamPlaybackSecurity, getStreamPublishSecurity, getSubscriberStream, handleEvent, hasBroadcastStream, hasOnDemandStream, join, leave, measureBandwidth, measureBandwidth, pauseScheduledJob, registerStreamPlaybackSecurity, registerStreamPublishSecurity, rejectClient, rejectClient, removeListener, removeScheduledJob, resumeScheduledJob, roomConnect, roomDisconnect, roomJoin, roomLeave, roomStart, roomStop, setClientTTL, setGhostConnsCleanupPeriod, start, startTransmit, stop, stopTransmit, stopTransmit, streamBroadcastClose, streamBroadcastStart, streamPlayItemPause, streamPlayItemResume, streamPlayItemSeek, streamPublishStart, streamRecordStart, streamRecordStop, streamSubscriberStart, unregisterStreamPlaybackSecurity, unregisterStreamPublishSecurity
Methods inherited from class org.red5.server.adapter.StatefulScopeWrappingAdapter
createChildScope, getAttribute, getAttribute, getAttributeNames, getAttributes, getChildScope, getChildScopeNames, getClients, getConnections, getContext, getDepth, getName, getParent, getPath, getPlugins, getResource, getResources, getScope, hasAttribute, hasChildScope, hasParent, lookupConnections, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, setPlugins, setScope, size
Methods inherited from class org.red5.server.adapter.AbstractScopeAdapter
addChildScope, checkBandwidth, checkBandwidthUp, removeChildScope, serviceCall, setCanCallService, setCanConnect, setCanStart, setJoin
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.antmedia.muxer.IAntMediaStreamHandler
getScope
Methods inherited from interface org.red5.server.api.scope.IScopeHandler
addChildScope, removeChildScope, serviceCall
-
Field Details
-
STREAM_TIMEOUT_MS
public static final int STREAM_TIMEOUT_MSTimeout value that stream is considered as finished or stuck- See Also:
-
BEAN_NAME
- See Also:
-
BROADCAST_STATS_RESET
public static final int BROADCAST_STATS_RESET- See Also:
-
HOOK_ACTION_END_LIVE_STREAM
- See Also:
-
HOOK_ACTION_START_LIVE_STREAM
- See Also:
-
HOOK_ACTION_STREAM_STATUS
- See Also:
-
HOOK_ACTION_VOD_READY
- See Also:
-
HOOK_ACTION_PUBLISH_TIMEOUT_ERROR
- See Also:
-
HOOK_ACTION_ENCODER_NOT_OPENED_ERROR
- See Also:
-
HOOK_ACTION_ENDPOINT_FAILED
- See Also:
-
HOOK_ACTION_PLAY_STOPPED
This is used to notify that the play is stopped- See Also:
-
HOOK_ACTION_PLAY_STARTED
This is used to notify that the play is started- See Also:
-
HOOK_ACTION_SUBTRACK_ADDED_IN_THE_MAINTRACK
This is used to notify that the subtrack is created in the main track In video conferencing, it means a stream is started in the room- See Also:
-
HOOK_ACTION_SUBTRACK_LEFT_FROM_THE_MAINTRACK
This is used to notify that the subtrack left the main track In video conferencing, it means a stream left the room- See Also:
-
HOOK_ACTION_FIRST_ACTIVE_SUBTRACK_ADDED_IN_THE_MAINTRACK
This is used to notify that the first active subtrack is created in the main track In video conferencing, it means the first stream is started in the room- See Also:
-
HOOK_ACTION_NO_ACTIVE_SUBTRACKS_LEFT_IN_THE_MAINTRACK
This is used to notify that there is no active subtracks left in the main track. In video conferencing, it means there is no active stream left in the room- See Also:
-
STREAMS
- See Also:
-
DEFAULT_LOCALHOST
- See Also:
-
logger
protected static org.slf4j.Logger logger -
serverSettings
-
VOD
- See Also:
-
LIVE_STREAM
- See Also:
-
IP_CAMERA
- See Also:
-
STREAM_SOURCE
- See Also:
-
PLAY_LIST
- See Also:
-
END_POINT_LIMIT
protected static final int END_POINT_LIMIT- See Also:
-
CLUSTER_POST_RETRY_ATTEMPT_COUNT
public static final int CLUSTER_POST_RETRY_ATTEMPT_COUNT- See Also:
-
CLUSTER_POST_TIMEOUT_MS
public static final int CLUSTER_POST_TIMEOUT_MS- See Also:
-
VOD_IMPORT_ALLOWED_DIRECTORY
- See Also:
-
streamPublishSecurityList
-
onvifCameraList
-
streamFetcherManager
-
muxAdaptors
-
dataStore
-
dataStoreFactory
-
streamAcceptFilter
-
appSettings
-
vertx
private io.vertx.core.Vertx vertx -
encoderBlockedStreams
-
numberOfEncoderNotOpenedErrors
private int numberOfEncoderNotOpenedErrors -
publishTimeoutStreams
protected int publishTimeoutStreams -
publishTimeoutStreamsList
-
shutdownProperly
private boolean shutdownProperly -
webRTCVideoReceiveStats
-
webRTCAudioReceiveStats
-
webRTCVideoSendStats
-
webRTCAudioSendStats
-
clusterNotifier
-
serverShuttingDown
protected boolean serverShuttingDown -
storageClient
-
streamListeners
-
playListSchedulerTimer
-
clusterStreamFetcher
IClusterStreamFetcher clusterStreamFetcher -
subtrackPoller
-
random
-
statsCollector
-
settingsUpdateListenerSet
-
-
Constructor Details
-
AntMediaApplicationAdapter
public AntMediaApplicationAdapter()
-
-
Method Details
-
appStart
Description copied from class:MultiThreadedApplicationAdapter
Called once on scope (that is, application or application room) start. You overrideMultiThreadedApplicationAdapter.appStart(IScope)
orMultiThreadedApplicationAdapter.roomStart(IScope)
in your application to make it act the way you want.- Specified by:
appStart
in interfaceApplicationMXBean
- Overrides:
appStart
in classMultiThreadedApplicationAdapter
- Parameters:
app
- Application scope object- Returns:
true
if scope can be started,false
otherwise
-
schedulePlayList
-
cancelPlaylistSchedule
-
resetBroadcasts
This method is called after ungraceful shutdown- Returns:
-
synchUserVoDFolder
- Parameters:
oldFolderPath
-vodFolderPath
-- Returns:
-
createSymbolicLink
-
importVoDFolder
Import vod files recursively in the directory. It also created symbolic link to make the files streamable- Parameters:
vodFolderPath
- absolute path of the vod folder to be imported- Returns:
-
unlinksVoD
-
deleteUserVoDByStreamId
-
importToDB
-
deleteSymbolicLink
Deletes the symbolic link under the streams directory- Parameters:
vodDirectory
-streamsFolder
-- Returns:
- Throws:
IOException
-
getListenerHookURL
-
closeBroadcast
-
saveMainBroadcast
-
isInstanceAlive
-
isEndpointReachable
-
updateMainTrackWithRecentlyFinishedBroadcast
If multiple threads enter the method at the same time, the following method does not work correctly. So we have made it synchronized It fixes the bug that sometimes main track(room) is not deleted in the video conferences mekya- Parameters:
finishedBroadcast
-
-
resetHLSStats
-
resetDASHStats
-
streamPlayItemPlay
Description copied from interface:IStreamAwareScopeHandler
Notified when a play item plays.- Specified by:
streamPlayItemPlay
in interfaceIStreamAwareScopeHandler
- Overrides:
streamPlayItemPlay
in classMultiThreadedApplicationAdapter
- Parameters:
stream
- streamitem
- itemisLive
- true if live
-
streamPlayItemStop
Description copied from interface:IStreamAwareScopeHandler
Notified when a play item stops.- Specified by:
streamPlayItemStop
in interfaceIStreamAwareScopeHandler
- Overrides:
streamPlayItemStop
in classMultiThreadedApplicationAdapter
- Parameters:
stream
- streamitem
- item
-
streamSubscriberClose
Description copied from interface:IStreamAwareScopeHandler
Notified when a subscriber closes.- Specified by:
streamSubscriberClose
in interfaceIStreamAwareScopeHandler
- Overrides:
streamSubscriberClose
in classMultiThreadedApplicationAdapter
- Parameters:
stream
- stream
-
startPublish
Description copied from interface:IAntMediaStreamHandler
Notify the handler that stream is started to publish- Specified by:
startPublish
in interfaceIAntMediaStreamHandler
-
updateBroadcastStatus
public Broadcast updateBroadcastStatus(String streamId, long absoluteStartTimeMs, String publishType, Broadcast broadcast) Description copied from interface:IAntMediaStreamHandler
Update broadcast status to BROADCASTING- Specified by:
updateBroadcastStatus
in interfaceIAntMediaStreamHandler
- 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
-
updateBroadcastStatus
-
getServerSettings
-
saveUndefinedBroadcast
-
muxingFinished
@Deprecated public void muxingFinished(String streamId, File File, long startTime, long duration, int resolution, String previewFilePath, String vodId) Deprecated.Description copied from interface:IAntMediaStreamHandler
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- Specified by:
muxingFinished
in interfaceIAntMediaStreamHandler
- Parameters:
streamId
- is the name of the stream publishedFile
- video file that muxed is finishedduration
- of the video in millisecondsresolution
- height of the video
-
muxingFinished
public void muxingFinished(Broadcast broadcast, String streamId, File file, long startTime, long duration, int resolution, String previewFilePath, String vodId) Description copied from interface:IAntMediaStreamHandler
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- Specified by:
muxingFinished
in interfaceIAntMediaStreamHandler
- 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
-
notifyFirstActiveSubtrackInMainTrack
-
notifyNoActiveSubtracksLeftInMainTrack
-
runScript
-
getRelativePath
-
sendWebHook
-
notifyHook
public void notifyHook(@NotNull @NotNull String url, String id, String mainTrackId, String action, String streamName, String category, String vodName, String vodId, String metadata, String subscriberId) Notify hook with parameters below- Parameters:
streamName
- , name of the stream. It is not the name of the file. It is just a user friendly namecategory
- , category of the streamurl
- is the url of the service to be calledid
- is the stream id that is unique for each streammainTrackId
- mainTrackId(roomId) of the streamaction
- is the name of the action to be notified, it has values such asHOOK_ACTION_END_LIVE_STREAM
HOOK_ACTION_START_LIVE_STREAM
vodName
- name of the vodvodId
- id of the vod in the datastore
-
notifyWebhookForStreamStatus
public void notifyWebhookForStreamStatus(Broadcast broadcast, int width, int height, long totalByteReceived, int inputQueueSize, int encodingQueueSize, int dropFrameCountInEncoding, int dropPacketCountInIngestion, double speed) Description copied from interface:IAntMediaStreamHandler
Notify the webhook about the stream status- Specified by:
notifyWebhookForStreamStatus
in interfaceIAntMediaStreamHandler
-
putToMap
-
sendClusterPost
-
callClusterRestMethod
-
trySendClusterPostWithDelay
public void trySendClusterPostWithDelay(String url, String clusterCommunicationToken, int retryAttempts, CompletableFuture<Boolean> future) -
sendPOST
public void sendPOST(String url, Map<String, Object> variables, int retryAttempts, String contentType) - Parameters:
url
-variables
-retryAttempts
-sendType
- the type of the entity to be sent. It can be either "application/x-www-form-urlencoded" or "application/json"
-
retrySendPostWithDelay
-
getHttpClient
public org.apache.http.impl.client.CloseableHttpClient getHttpClient() -
getStreamPublishSecurityList
-
setStreamPublishSecurityList
-
getAppSettings
Description copied from interface:IAntMediaStreamHandler
Get the AppSettings of the application- Specified by:
getAppSettings
in interfaceIAntMediaStreamHandler
- Returns:
- AppSettings
-
setAppSettings
-
getStreamAcceptFilter
-
setStreamAcceptFilter
-
isValidStreamParameters
public boolean isValidStreamParameters(int width, int height, int fps, int bitrate, String streamId) Description copied from interface:IAntMediaStreamHandler
Checks a Stream parameters is valid.- Specified by:
isValidStreamParameters
in interfaceIAntMediaStreamHandler
-
isStreaming
Important information: Status field of Broadcast class checks the update time to report the status is broadcasting or not.Broadcast.getStatus()
-
startStreaming
-
forwardStartStreaming
-
stopStreaming
-
getOnvifCamera
-
getStreamFetcherManager
-
setStreamFetcherManager
-
setQualityParameters
Description copied from interface:IAntMediaStreamHandler
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.- Specified by:
setQualityParameters
in interfaceIAntMediaStreamHandler
- Parameters:
streamId
- The unique identifier of the stream.stats
- The current publishing statistics for the stream.currentTimeMillis
- The current timestamp in milliseconds.
-
setQualityParameters
public void setQualityParameters(String id, String quality, double speed, int pendingPacketSize, long updateTimeMs) Description copied from interface:IAntMediaStreamHandler
Update stream quality, speed and number of pending packet size and update time in datastore- Specified by:
setQualityParameters
in interfaceIAntMediaStreamHandler
quality
- , 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 1x
-
getDataStore
Description copied from interface:IAntMediaStreamHandler
Get the DataStore of the application- Specified by:
getDataStore
in interfaceIAntMediaStreamHandler
- Returns:
- DataStore
-
setDataStore
-
getDataStoreFactory
-
setDataStoreFactory
-
setVertx
public void setVertx(io.vertx.core.Vertx vertx) This setter for test cases- Parameters:
vertx
-
-
closeRTMPStreams
public void closeRTMPStreams() -
closeStreamFetchers
public void closeStreamFetchers() -
waitUntilLiveStreamsStopped
public void waitUntilLiveStreamsStopped() -
waitUntilThreadsStop
public void waitUntilThreadsStop() -
getActiveVertxThreadCount
private int getActiveVertxThreadCount() -
serverShuttingdown
public void serverShuttingdown()- Specified by:
serverShuttingdown
in interfaceIShutdownListener
-
appStop
Description copied from class:MultiThreadedApplicationAdapter
Handler method. Called when application is stopped.- Specified by:
appStop
in interfaceApplicationMXBean
- Overrides:
appStop
in classMultiThreadedApplicationAdapter
- Parameters:
app
- Scope object
-
stopApplication
public void stopApplication(boolean deleteDB) -
closeDB
public void closeDB(boolean deleteDB) -
createInitializationProcess
-
createInitializationFile
public void createInitializationFile(String appName, Result result, File initializedFile) throws IOException - Throws:
IOException
-
createShutdownFile
-
isShutdownProperly
public boolean isShutdownProperly() -
setShutdownProperly
public void setShutdownProperly(boolean shutdownProperly) -
muxAdaptorAdded
Description copied from interface:IAntMediaStreamHandler
Adds a MuxAdaptor when a muxAdaptor is created- Specified by:
muxAdaptorAdded
in interfaceIAntMediaStreamHandler
-
muxAdaptorRemoved
Description copied from interface:IAntMediaStreamHandler
Removes a MuxAdaptor when a muxAdaptor is closingResources- Specified by:
muxAdaptorRemoved
in interfaceIAntMediaStreamHandler
-
getMuxAdaptor
Description copied from interface:IAntMediaStreamHandler
Get the MuxAdaptor of the stream. MuxAdaptor is the base class that is responsible for ingesting and distributing the stream- Specified by:
getMuxAdaptor
in interfaceIAntMediaStreamHandler
- Returns:
-
getMuxAdaptors
-
getNumberOfEncodersBlocked
public int getNumberOfEncodersBlocked()Number of encoders blocked.- Returns:
-
encoderBlocked
-
incrementEncoderNotOpenedError
-
getNumberOfEncoderNotOpenedErrors
public int getNumberOfEncoderNotOpenedErrors() -
getNumberOfPublishTimeoutError
public int getNumberOfPublishTimeoutError() -
publishTimeoutError
-
getWebRTCAudioReceiveStats
-
getWebRTCVideoReceiveStats
-
getWebRTCAudioSendStats
-
getWebRTCVideoSendStats
-
getVertx
public io.vertx.core.Vertx getVertx() -
updateSettings
public boolean updateSettings(AppSettings newSettings, boolean notifyCluster, boolean checkUpdateTime) -
notifySettingsUpdateListeners
-
addSettingsUpdateListener
Description copied from interface:IAntMediaStreamHandler
Add listener that is notified when the settings are updated- Specified by:
addSettingsUpdateListener
in interfaceIAntMediaStreamHandler
-
isEncoderSettingsValid
-
isTokenSecuritySettingsValid
-
isIncomingSettingsDifferent
- Parameters:
newSettings
-checkUpdateTime
-- Returns:
- true if time are not equal, it means new settings is different than the current settings
-
setClusterNotifier
-
updateAppSettingsFile
-
updateAppSettingsBean
public void updateAppSettingsBean(AppSettings appSettings, AppSettings newSettings, boolean updateTime) -
setStorageclientSettings
-
setAppSettingsFieldValue
public static boolean setAppSettingsFieldValue(AppSettings appSettings, AppSettings newSettings, Field field) -
setServerSettings
-
getRTMPToWebRTCStats
-
isDataChannelEnabled
public boolean isDataChannelEnabled() -
isDataChannelMessagingSupported
public boolean isDataChannelMessagingSupported() -
sendDataChannelMessage
-
doesWebRTCStreamExist
-
addPacketListener
Description copied from interface:IAntMediaStreamHandler
Add listener to get audio and video packets from the internal of Ant Media Server. 'Packet' is the encoded data of audio/video 'Frame'.- Specified by:
addPacketListener
in interfaceIAntMediaStreamHandler
- Returns:
-
endpointFailedUpdate
-
removePacketListener
Description copied from interface:IAntMediaStreamHandler
Remove listener from the Stream Handler to stop getting notified- Specified by:
removePacketListener
in interfaceIAntMediaStreamHandler
- Returns:
-
addFrameListener
Description copied from interface:IAntMediaStreamHandler
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'- Specified by:
addFrameListener
in interfaceIAntMediaStreamHandler
-
createCustomBroadcast
Description copied from interface:IAntMediaStreamHandler
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- Specified by:
createCustomBroadcast
in interfaceIAntMediaStreamHandler
- Returns:
-
createCustomBroadcast
Description copied from interface:IAntMediaStreamHandler
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- Specified by:
createCustomBroadcast
in interfaceIAntMediaStreamHandler
- Returns:
-
stopCustomBroadcast
Description copied from interface:IAntMediaStreamHandler
Stop the custom broadcast that is being created. Stop encoders and make database operations.- Specified by:
stopCustomBroadcast
in interfaceIAntMediaStreamHandler
-
removeFrameListener
Description copied from interface:IAntMediaStreamHandler
Remove frame listener from the Stream Handler to stop getting notified- Specified by:
removeFrameListener
in interfaceIAntMediaStreamHandler
-
isServerShuttingDown
public boolean isServerShuttingDown()- Specified by:
isServerShuttingDown
in interfaceIAntMediaStreamHandler
- Returns:
- true if server is shutting down
-
setStorageClient
-
getStorageClient
-
addStreamListener
Description copied from interface:IAntMediaStreamHandler
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.- Specified by:
addStreamListener
in interfaceIAntMediaStreamHandler
-
removeStreamListener
Description copied from interface:IAntMediaStreamHandler
Remove a stream listener from the Stream Handler to stop getting notified- Specified by:
removeStreamListener
in interfaceIAntMediaStreamHandler
-
stopPlaying
-
startHttpSignaling
public CompletableFuture<Result> startHttpSignaling(PublishParameters publishParameters, String sdp, String sessionId) -
stopWhipBroadcast
-
stopPlayingBySubscriberId
-
stopPublishingBySubscriberId
-
stopPublish
Description copied from interface:IAntMediaStreamHandler
Notify the handler that is stream is stopped- Specified by:
stopPublish
in interfaceIAntMediaStreamHandler
-
isClusterMode
public boolean isClusterMode() -
joinedTheRoom
-
leftTheRoom
-
createClusterStreamFetcher
-
getWebRTCClientsMap
-
getSubtrackPoller
-
setSubtrackPoller
-
getPlayListSchedulerTimer
-
getStatsCollector
-
setStatsCollector
-