Package io.antmedia

Class 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 Details

    • STREAM_TIMEOUT_MS

      public static final int STREAM_TIMEOUT_MS
      Timeout value that stream is considered as finished or stuck
      See Also:
    • BEAN_NAME

      public static final String BEAN_NAME
      See Also:
    • BROADCAST_STATS_RESET

      public static final int BROADCAST_STATS_RESET
      See Also:
    • HOOK_ACTION_END_LIVE_STREAM

      public static final String HOOK_ACTION_END_LIVE_STREAM
      See Also:
    • HOOK_ACTION_START_LIVE_STREAM

      public static final String HOOK_ACTION_START_LIVE_STREAM
      See Also:
    • HOOK_ACTION_STREAM_STATUS

      public static final String HOOK_ACTION_STREAM_STATUS
      See Also:
    • HOOK_ACTION_VOD_READY

      public static final String HOOK_ACTION_VOD_READY
      See Also:
    • HOOK_ACTION_PUBLISH_TIMEOUT_ERROR

      public static final String HOOK_ACTION_PUBLISH_TIMEOUT_ERROR
      See Also:
    • HOOK_ACTION_ENCODER_NOT_OPENED_ERROR

      public static final String HOOK_ACTION_ENCODER_NOT_OPENED_ERROR
      See Also:
    • HOOK_ACTION_ENDPOINT_FAILED

      public static final String HOOK_ACTION_ENDPOINT_FAILED
      See Also:
    • HOOK_ACTION_PLAY_STOPPED

      public static final String HOOK_ACTION_PLAY_STOPPED
      This is used to notify that the play is stopped
      See Also:
    • HOOK_ACTION_PLAY_STARTED

      public static final String HOOK_ACTION_PLAY_STARTED
      This is used to notify that the play is started
      See Also:
    • HOOK_ACTION_SUBTRACK_ADDED_IN_THE_MAINTRACK

      public static final String 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

      public static final String 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

      public static final String 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

      public static final String 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

      public static final String STREAMS
      See Also:
    • DEFAULT_LOCALHOST

      public static final String DEFAULT_LOCALHOST
      See Also:
    • logger

      protected static org.slf4j.Logger logger
    • serverSettings

      private ServerSettings serverSettings
    • VOD

      public static final String VOD
      See Also:
    • LIVE_STREAM

      public static final String LIVE_STREAM
      See Also:
    • IP_CAMERA

      public static final String IP_CAMERA
      See Also:
    • STREAM_SOURCE

      public static final String STREAM_SOURCE
      See Also:
    • PLAY_LIST

      public static final String 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

      private static final String VOD_IMPORT_ALLOWED_DIRECTORY
      See Also:
    • streamPublishSecurityList

      private List<IStreamPublishSecurity> streamPublishSecurityList
    • onvifCameraList

      private Map<String,OnvifCamera> onvifCameraList
    • streamFetcherManager

      protected StreamFetcherManager streamFetcherManager
    • muxAdaptors

      protected Map<String,MuxAdaptor> muxAdaptors
    • dataStore

      private DataStore dataStore
    • dataStoreFactory

      private DataStoreFactory dataStoreFactory
    • streamAcceptFilter

      private StreamAcceptFilter streamAcceptFilter
    • appSettings

      private AppSettings appSettings
    • vertx

      private io.vertx.core.Vertx vertx
    • encoderBlockedStreams

      protected List<String> encoderBlockedStreams
    • numberOfEncoderNotOpenedErrors

      private int numberOfEncoderNotOpenedErrors
    • publishTimeoutStreams

      protected int publishTimeoutStreams
    • publishTimeoutStreamsList

      private List<String> publishTimeoutStreamsList
    • shutdownProperly

      private boolean shutdownProperly
    • webRTCVideoReceiveStats

      protected WebRTCVideoReceiveStats webRTCVideoReceiveStats
    • webRTCAudioReceiveStats

      protected WebRTCAudioReceiveStats webRTCAudioReceiveStats
    • webRTCVideoSendStats

      protected WebRTCVideoSendStats webRTCVideoSendStats
    • webRTCAudioSendStats

      protected WebRTCAudioSendStats webRTCAudioSendStats
    • clusterNotifier

      private IClusterNotifier clusterNotifier
    • serverShuttingDown

      protected boolean serverShuttingDown
    • storageClient

      protected StorageClient storageClient
    • streamListeners

      protected Queue<IStreamListener> streamListeners
    • playListSchedulerTimer

      protected Map<String,Long> playListSchedulerTimer
    • clusterStreamFetcher

      IClusterStreamFetcher clusterStreamFetcher
    • subtrackPoller

      protected ISubtrackPoller subtrackPoller
    • random

      private Random random
    • statsCollector

      private IStatsCollector statsCollector
    • settingsUpdateListenerSet

      private Set<IAppSettingsUpdateListener> settingsUpdateListenerSet
  • Constructor Details

    • AntMediaApplicationAdapter

      public AntMediaApplicationAdapter()
  • Method Details

    • appStart

      public boolean appStart(IScope app)
      Description copied from class: MultiThreadedApplicationAdapter
      Called once on scope (that is, application or application room) start. You override MultiThreadedApplicationAdapter.appStart(IScope) or MultiThreadedApplicationAdapter.roomStart(IScope) in your application to make it act the way you want.
      Specified by:
      appStart in interface ApplicationMXBean
      Overrides:
      appStart in class MultiThreadedApplicationAdapter
      Parameters:
      app - Application scope object
      Returns:
      true if scope can be started, false otherwise
    • schedulePlayList

      public void schedulePlayList(long now, Broadcast broadcast)
    • cancelPlaylistSchedule

      public void cancelPlaylistSchedule(String streamId)
    • resetBroadcasts

      public Result resetBroadcasts()
      This method is called after ungraceful shutdown
      Returns:
    • synchUserVoDFolder

      public boolean synchUserVoDFolder(String oldFolderPath, String vodFolderPath)
      Parameters:
      oldFolderPath -
      vodFolderPath -
      Returns:
    • createSymbolicLink

      public Result createSymbolicLink(File streamsFolder, File vodFolder)
    • importVoDFolder

      public Result importVoDFolder(String vodFolderPath)
      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

      public Result unlinksVoD(String directory)
    • deleteUserVoDByStreamId

      private int deleteUserVoDByStreamId(String streamId)
    • importToDB

      public int importToDB(File subDirectory, File baseDirectory)
    • deleteSymbolicLink

      public boolean deleteSymbolicLink(File vodDirectory, File streamsFolder)
      Deletes the symbolic link under the streams directory
      Parameters:
      vodDirectory -
      streamsFolder -
      Returns:
      Throws:
      IOException
    • getListenerHookURL

      public String getListenerHookURL(Broadcast broadcast)
    • closeBroadcast

      public void closeBroadcast(String streamId)
    • saveMainBroadcast

      public static Broadcast saveMainBroadcast(String streamId, String mainTrackId, DataStore dataStore)
    • isInstanceAlive

      public static boolean isInstanceAlive(String originAdress, String hostAddress, int httpPort, String appName)
    • isEndpointReachable

      public static boolean isEndpointReachable(String endpoint)
    • updateMainTrackWithRecentlyFinishedBroadcast

      public void updateMainTrackWithRecentlyFinishedBroadcast(Broadcast finishedBroadcast)
      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

      public void resetHLSStats(String streamId)
    • resetDASHStats

      public void resetDASHStats(String streamId)
    • streamPlayItemPlay

      public void streamPlayItemPlay(ISubscriberStream stream, IPlayItem item, boolean isLive)
      Description copied from interface: IStreamAwareScopeHandler
      Notified when a play item plays.
      Specified by:
      streamPlayItemPlay in interface IStreamAwareScopeHandler
      Overrides:
      streamPlayItemPlay in class MultiThreadedApplicationAdapter
      Parameters:
      stream - stream
      item - item
      isLive - true if live
    • streamPlayItemStop

      public void streamPlayItemStop(ISubscriberStream stream, IPlayItem item)
      Description copied from interface: IStreamAwareScopeHandler
      Notified when a play item stops.
      Specified by:
      streamPlayItemStop in interface IStreamAwareScopeHandler
      Overrides:
      streamPlayItemStop in class MultiThreadedApplicationAdapter
      Parameters:
      stream - stream
      item - item
    • streamSubscriberClose

      public void streamSubscriberClose(ISubscriberStream stream)
      Description copied from interface: IStreamAwareScopeHandler
      Notified when a subscriber closes.
      Specified by:
      streamSubscriberClose in interface IStreamAwareScopeHandler
      Overrides:
      streamSubscriberClose in class MultiThreadedApplicationAdapter
      Parameters:
      stream - stream
    • startPublish

      public void startPublish(String streamId, long absoluteStartTimeMs, String publishType)
      Description copied from interface: IAntMediaStreamHandler
      Notify the handler that stream is started to publish
      Specified by:
      startPublish in interface IAntMediaStreamHandler
    • 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 interface IAntMediaStreamHandler
      Parameters:
      streamId - is the id of the stream.
      absoluteStartTimeMs - : @deprecated It's not used anymore. It's the absolute start time if available
      publishType - : It's RTMP, WebRTC, StreamSource
      broadcast - : It's the broadcast object. If it's null, a new record will be created
      Returns:
      broadcast object from database
    • updateBroadcastStatus

      public Broadcast updateBroadcastStatus(String streamId, long absoluteStartTimeMs, String publishType, Broadcast broadcast, String status)
    • getServerSettings

      public ServerSettings getServerSettings()
    • saveUndefinedBroadcast

      public static Broadcast saveUndefinedBroadcast(String streamId, String streamName, AntMediaApplicationAdapter appAdapter, String streamStatus, long absoluteStartTimeMs, String publishType, String mainTrackStreamId, String metaData, String role)
    • 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 interface IAntMediaStreamHandler
      Parameters:
      streamId - is the name of the stream published
      File - video file that muxed is finished
      duration - of the video in milliseconds
      resolution - 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 interface IAntMediaStreamHandler
      Parameters:
      broadcast - object that muxed is finished
      streamId - is the id of the stream
      file - video file that muxed is finished
      duration - of the video in milliseconds
      resolution - height of the video
    • notifyFirstActiveSubtrackInMainTrack

      public void notifyFirstActiveSubtrackInMainTrack(Broadcast mainTrack, String subtrackId)
    • notifyNoActiveSubtracksLeftInMainTrack

      public void notifyNoActiveSubtracksLeftInMainTrack(Broadcast mainTrack)
    • runScript

      public void runScript(String scriptFile)
    • getRelativePath

      public static String getRelativePath(String filePath)
    • sendWebHook

      public void sendWebHook(String id, String mainTrackId, String action, String streamName, String category, String vodName, String vodId, String metadata, String subscriberId)
    • 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 name
      category - , category of the stream
      url - is the url of the service to be called
      id - is the stream id that is unique for each stream
      mainTrackId - mainTrackId(roomId) of the stream
      action - is the name of the action to be notified, it has values such as HOOK_ACTION_END_LIVE_STREAM HOOK_ACTION_START_LIVE_STREAM
      vodName - name of the vod
      vodId - 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 interface IAntMediaStreamHandler
    • putToMap

      private void putToMap(String keyName, Object keyValue, Map<String,Object> map)
    • sendClusterPost

      public boolean sendClusterPost(String url, String clusterCommunicationToken)
    • callClusterRestMethod

      public boolean callClusterRestMethod(String url, String clusterCommunicationToken)
    • 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

      public void retrySendPostWithDelay(String url, Map<String,Object> variables, int retryAttempts, String contentType)
    • getHttpClient

      public org.apache.http.impl.client.CloseableHttpClient getHttpClient()
    • getStreamPublishSecurityList

      public List<IStreamPublishSecurity> getStreamPublishSecurityList()
    • setStreamPublishSecurityList

      public void setStreamPublishSecurityList(List<IStreamPublishSecurity> streamPublishSecurityList)
    • getAppSettings

      public AppSettings getAppSettings()
      Description copied from interface: IAntMediaStreamHandler
      Get the AppSettings of the application
      Specified by:
      getAppSettings in interface IAntMediaStreamHandler
      Returns:
      AppSettings
    • setAppSettings

      public void setAppSettings(AppSettings appSettings)
    • getStreamAcceptFilter

      public StreamAcceptFilter getStreamAcceptFilter()
    • setStreamAcceptFilter

      public void setStreamAcceptFilter(StreamAcceptFilter streamAcceptFilter)
    • 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 interface IAntMediaStreamHandler
    • isStreaming

      public 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. Broadcast.getStatus()
    • startStreaming

      public Result startStreaming(Broadcast broadcast)
    • forwardStartStreaming

      public void forwardStartStreaming(Broadcast broadcast)
    • stopStreaming

      public Result stopStreaming(Broadcast broadcast, boolean stopSubtracks)
    • getOnvifCamera

      public OnvifCamera getOnvifCamera(String id)
    • getStreamFetcherManager

      public StreamFetcherManager getStreamFetcherManager()
    • setStreamFetcherManager

      public void setStreamFetcherManager(StreamFetcherManager streamFetcherManager)
    • setQualityParameters

      public void setQualityParameters(String streamId, PublishStatsEvent stats, long currentTimeMillis)
      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 interface IAntMediaStreamHandler
      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 interface IAntMediaStreamHandler
      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

      public DataStore getDataStore()
      Description copied from interface: IAntMediaStreamHandler
      Get the DataStore of the application
      Specified by:
      getDataStore in interface IAntMediaStreamHandler
      Returns:
      DataStore
    • setDataStore

      public void setDataStore(DataStore dataStore)
    • getDataStoreFactory

      public DataStoreFactory getDataStoreFactory()
    • setDataStoreFactory

      public void setDataStoreFactory(DataStoreFactory dataStoreFactory)
    • 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 interface IShutdownListener
    • appStop

      public void appStop(IScope app)
      Description copied from class: MultiThreadedApplicationAdapter
      Handler method. Called when application is stopped.
      Specified by:
      appStop in interface ApplicationMXBean
      Overrides:
      appStop in class MultiThreadedApplicationAdapter
      Parameters:
      app - Scope object
    • stopApplication

      public void stopApplication(boolean deleteDB)
    • closeDB

      public void closeDB(boolean deleteDB)
    • createInitializationProcess

      public Result createInitializationProcess(String appName)
    • createInitializationFile

      public void createInitializationFile(String appName, Result result, File initializedFile) throws IOException
      Throws:
      IOException
    • createShutdownFile

      public void createShutdownFile(String appName)
    • isShutdownProperly

      public boolean isShutdownProperly()
    • setShutdownProperly

      public void setShutdownProperly(boolean shutdownProperly)
    • muxAdaptorAdded

      public void muxAdaptorAdded(MuxAdaptor muxAdaptor)
      Description copied from interface: IAntMediaStreamHandler
      Adds a MuxAdaptor when a muxAdaptor is created
      Specified by:
      muxAdaptorAdded in interface IAntMediaStreamHandler
    • muxAdaptorRemoved

      public void muxAdaptorRemoved(MuxAdaptor muxAdaptor)
      Description copied from interface: IAntMediaStreamHandler
      Removes a MuxAdaptor when a muxAdaptor is closingResources
      Specified by:
      muxAdaptorRemoved in interface IAntMediaStreamHandler
    • getMuxAdaptor

      public MuxAdaptor getMuxAdaptor(String streamId)
      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 interface IAntMediaStreamHandler
      Returns:
    • getMuxAdaptors

      public Collection<MuxAdaptor> getMuxAdaptors()
    • getNumberOfEncodersBlocked

      public int getNumberOfEncodersBlocked()
      Number of encoders blocked.
      Returns:
    • encoderBlocked

      public void encoderBlocked(String streamId, boolean blocked)
    • incrementEncoderNotOpenedError

      public void incrementEncoderNotOpenedError(String streamId)
    • getNumberOfEncoderNotOpenedErrors

      public int getNumberOfEncoderNotOpenedErrors()
    • getNumberOfPublishTimeoutError

      public int getNumberOfPublishTimeoutError()
    • publishTimeoutError

      public void publishTimeoutError(String streamId, String subscriberId)
    • getWebRTCAudioReceiveStats

      public WebRTCAudioReceiveStats getWebRTCAudioReceiveStats()
    • getWebRTCVideoReceiveStats

      public WebRTCVideoReceiveStats getWebRTCVideoReceiveStats()
    • getWebRTCAudioSendStats

      public WebRTCAudioSendStats getWebRTCAudioSendStats()
    • getWebRTCVideoSendStats

      public WebRTCVideoSendStats getWebRTCVideoSendStats()
    • getVertx

      public io.vertx.core.Vertx getVertx()
    • updateSettings

      public boolean updateSettings(AppSettings newSettings, boolean notifyCluster, boolean checkUpdateTime)
    • notifySettingsUpdateListeners

      public void notifySettingsUpdateListeners(AppSettings appSettings)
    • addSettingsUpdateListener

      public void addSettingsUpdateListener(IAppSettingsUpdateListener listener)
      Description copied from interface: IAntMediaStreamHandler
      Add listener that is notified when the settings are updated
      Specified by:
      addSettingsUpdateListener in interface IAntMediaStreamHandler
    • isEncoderSettingsValid

      private boolean isEncoderSettingsValid(List<EncoderSettings> encoderSettingsList)
    • isTokenSecuritySettingsValid

      private boolean isTokenSecuritySettingsValid(AppSettings newSettings)
    • isIncomingSettingsDifferent

      public boolean isIncomingSettingsDifferent(AppSettings newSettings)
      Parameters:
      newSettings -
      checkUpdateTime -
      Returns:
      true if time are not equal, it means new settings is different than the current settings
    • setClusterNotifier

      public void setClusterNotifier(IClusterNotifier clusterNotifier)
    • updateAppSettingsFile

      public static boolean updateAppSettingsFile(String appName, AppSettings newAppsettings)
    • updateAppSettingsBean

      public void updateAppSettingsBean(AppSettings appSettings, AppSettings newSettings, boolean updateTime)
    • setStorageclientSettings

      public void setStorageclientSettings(AppSettings settings)
    • setAppSettingsFieldValue

      public static boolean setAppSettingsFieldValue(AppSettings appSettings, AppSettings newSettings, Field field)
    • setServerSettings

      public void setServerSettings(ServerSettings serverSettings)
    • getRTMPToWebRTCStats

      public RTMPToWebRTCStats getRTMPToWebRTCStats(String streamId)
    • isDataChannelEnabled

      public boolean isDataChannelEnabled()
    • isDataChannelMessagingSupported

      public boolean isDataChannelMessagingSupported()
    • sendDataChannelMessage

      public boolean sendDataChannelMessage(String streamId, String message)
    • doesWebRTCStreamExist

      public boolean doesWebRTCStreamExist(String streamId)
    • addPacketListener

      public boolean addPacketListener(String streamId, IPacketListener listener)
      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 interface IAntMediaStreamHandler
      Returns:
    • endpointFailedUpdate

      public void endpointFailedUpdate(String streamId, String url)
    • removePacketListener

      public boolean removePacketListener(String streamId, IPacketListener listener)
      Description copied from interface: IAntMediaStreamHandler
      Remove listener from the Stream Handler to stop getting notified
      Specified by:
      removePacketListener in interface IAntMediaStreamHandler
      Returns:
    • addFrameListener

      public void addFrameListener(String streamId, IFrameListener listener)
      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 interface IAntMediaStreamHandler
    • createCustomBroadcast

      public IFrameListener createCustomBroadcast(String streamId)
      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 interface IAntMediaStreamHandler
      Returns:
    • createCustomBroadcast

      public IFrameListener createCustomBroadcast(String streamId, int height, int bitrate)
      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 interface IAntMediaStreamHandler
      Returns:
    • stopCustomBroadcast

      public void stopCustomBroadcast(String streamId)
      Description copied from interface: IAntMediaStreamHandler
      Stop the custom broadcast that is being created. Stop encoders and make database operations.
      Specified by:
      stopCustomBroadcast in interface IAntMediaStreamHandler
    • removeFrameListener

      public void removeFrameListener(String streamId, IFrameListener listener)
      Description copied from interface: IAntMediaStreamHandler
      Remove frame listener from the Stream Handler to stop getting notified
      Specified by:
      removeFrameListener in interface IAntMediaStreamHandler
    • isServerShuttingDown

      public boolean isServerShuttingDown()
      Specified by:
      isServerShuttingDown in interface IAntMediaStreamHandler
      Returns:
      true if server is shutting down
    • setStorageClient

      public void setStorageClient(StorageClient storageClient)
    • getStorageClient

      public StorageClient getStorageClient()
    • addStreamListener

      public void addStreamListener(IStreamListener listener)
      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 interface IAntMediaStreamHandler
    • removeStreamListener

      public void removeStreamListener(IStreamListener listener)
      Description copied from interface: IAntMediaStreamHandler
      Remove a stream listener from the Stream Handler to stop getting notified
      Specified by:
      removeStreamListener in interface IAntMediaStreamHandler
    • stopPlaying

      public boolean stopPlaying(String viewerId)
    • startHttpSignaling

      public CompletableFuture<Result> startHttpSignaling(PublishParameters publishParameters, String sdp, String sessionId)
    • stopWhipBroadcast

      public Result stopWhipBroadcast(String streamId, String sessionId)
    • stopPlayingBySubscriberId

      public boolean stopPlayingBySubscriberId(String subscriberId)
    • stopPublishingBySubscriberId

      public boolean stopPublishingBySubscriberId(String subscriberId)
    • stopPublish

      public void stopPublish(String streamId)
      Description copied from interface: IAntMediaStreamHandler
      Notify the handler that is stream is stopped
      Specified by:
      stopPublish in interface IAntMediaStreamHandler
    • isClusterMode

      public boolean isClusterMode()
    • joinedTheRoom

      public void joinedTheRoom(String roomId, String streamId)
    • leftTheRoom

      public void leftTheRoom(String mainTrackId, String subtrackId)
    • createClusterStreamFetcher

      public IClusterStreamFetcher createClusterStreamFetcher()
    • getWebRTCClientsMap

      public Map<String,Queue<IWebRTCClient>> getWebRTCClientsMap()
    • getSubtrackPoller

      public ISubtrackPoller getSubtrackPoller()
    • setSubtrackPoller

      public void setSubtrackPoller(ISubtrackPoller subtrackPoller)
    • getPlayListSchedulerTimer

      public Map<String,Long> getPlayListSchedulerTimer()
    • getStatsCollector

      public IStatsCollector getStatsCollector()
    • setStatsCollector

      public void setStatsCollector(IStatsCollector statsCollector)