Interface IAntMediaStreamHandler

All Known Implementing Classes:
AntMediaApplicationAdapter

public interface IAntMediaStreamHandler
  • Field Details

  • 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 published
      file - video file that muxed is finished
      duration - of the video in milliseconds
      resolution - 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 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
    • 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 stream
      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
      pendingPacketSize - Number of packets pending to be processed
      totalByteReceived -
      byteTransferred -
      currentTimeMillis -
    • setQualityParameters

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

      void muxAdaptorAdded(MuxAdaptor muxAdaptor)
      Adds a MuxAdaptor when a muxAdaptor is created
      Parameters:
      muxAdaptor -
    • muxAdaptorRemoved

      void muxAdaptorRemoved(MuxAdaptor muxAdaptor)
      Removes a MuxAdaptor when a muxAdaptor is closingResources
      Parameters:
      muxAdaptor -
    • isValidStreamParameters

      boolean isValidStreamParameters(int width, int height, int fps, int bitrate, String streamId)
      Checks a Stream parameters is valid.
      Parameters:
      inputFormatContext - , pkt, streamId
    • isServerShuttingDown

      boolean isServerShuttingDown()
      Returns:
      true if server is shutting down
    • startPublish

      void startPublish(String streamName, long absoluteStartTimeMs, String publishType)
      Notify the handler that stream is started to publish
      Parameters:
      streamName -
      absoluteStartTimeMs -
      publishType -
    • stopPublish

      void stopPublish(String streamId)
      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 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
    • addStreamListener

      void addStreamListener(IStreamListener listener)
      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

      void removeStreamListener(IStreamListener listener)
      Remove a stream listener from the Stream Handler to stop getting notified
      Parameters:
      listener -
    • addFrameListener

      void addFrameListener(String streamId, IFrameListener listener)
      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

      void removeFrameListener(String streamId, IFrameListener listener)
      Remove frame listener from the Stream Handler to stop getting notified
      Parameters:
      streamId -
      listener -
    • addPacketListener

      boolean addPacketListener(String streamId, IPacketListener listener)
      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

      boolean removePacketListener(String streamId, IPacketListener listener)
      Remove listener from the Stream Handler to stop getting notified
      Parameters:
      streamId -
      listener -
      Returns:
    • createCustomBroadcast

      IFrameListener createCustomBroadcast(String streamId)
      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

      IFrameListener createCustomBroadcast(String streamId, int height, int bitrate)
      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

      void stopCustomBroadcast(String streamId)
      Stop the custom broadcast that is being created. Stop encoders and make database operations.
      Parameters:
      streamId -
    • getMuxAdaptor

      MuxAdaptor getMuxAdaptor(String streamId)
      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

      void addSettingsUpdateListener(IAppSettingsUpdateListener listener)
      Add listener that is notified when the settings are updated
      Parameters:
      listener -