Class StreamFetcherManager

java.lang.Object
io.antmedia.streamsource.StreamFetcherManager

public class StreamFetcherManager extends Object
Organizes and checks stream fetcher and restarts them if it is required
Author:
davut
  • Field Details

    • logger

      protected static org.slf4j.Logger logger
    • streamCheckerCount

      private int streamCheckerCount
    • streamFetcherList

      private Map<String,StreamFetcher> streamFetcherList
    • streamCheckerIntervalMs

      private int streamCheckerIntervalMs
      Time period in milli seconds for checking stream fetchers status, restart issues etc. It's the same value with MuxAdaptor.STAT_UPDATE_PERIOD_MS because it updates the database record and let us understand if stream is alive with AntMediaApplicationAdapter#isStreaming(Broadcast)
    • datastore

      private DataStore datastore
    • scope

      private IScope scope
    • streamFetcherScheduleJobName

      private long streamFetcherScheduleJobName
    • isJobRunning

      protected AtomicBoolean isJobRunning
    • restartStreamAutomatically

      private boolean restartStreamAutomatically
    • vertx

      private io.vertx.core.Vertx vertx
    • lastRestartCount

      private int lastRestartCount
    • appSettings

      private AppSettings appSettings
    • licenseService

      private ILicenceService licenseService
    • serverShuttingDown

      boolean serverShuttingDown
    • serverSettings

      private ServerSettings serverSettings
  • Constructor Details

    • StreamFetcherManager

      public StreamFetcherManager(io.vertx.core.Vertx vertx, DataStore datastore, IScope scope)
  • Method Details

    • shuttingDown

      public void shuttingDown()
    • make

      public StreamFetcher make(Broadcast stream, IScope scope, io.vertx.core.Vertx vertx)
    • getStreamCheckerInterval

      public int getStreamCheckerInterval()
    • testSetStreamCheckerInterval

      public void testSetStreamCheckerInterval(int streamCheckerInterval)
      Set stream checker interval, this value is used in periodically checking the status of the stream fetchers
      Parameters:
      streamCheckerInterval - , time period of the stream fetcher check interval in milliseconds
    • isStreamRunning

      public boolean isStreamRunning(Broadcast broadcast)
    • startStreamScheduler

      public Result startStreamScheduler(StreamFetcher streamScheduler)
    • startStreaming

      public Result startStreaming(@Nonnull Broadcast broadcast)
    • stopStreaming

      public Result stopStreaming(String streamId)
    • stopCheckerJob

      public void stopCheckerJob()
    • checkStreamUrlWithHTTP

      public static Result checkStreamUrlWithHTTP(String url)
    • playNextItemInList

      public void playNextItemInList(String streamId, StreamFetcher.IStreamFetcherListener listener)
    • playItemInList

      public Result playItemInList(Broadcast playlist, StreamFetcher.IStreamFetcherListener listener, int index)
      Parameters:
      playlist -
      listener -
      index - if it's -1, it plays the next item, if it's zero or bigger, it skips that item to play
    • startPlaylist

      public Result startPlaylist(Broadcast playlist)
    • skipNextPlaylistQueue

      public Broadcast skipNextPlaylistQueue(Broadcast playlist, int index)
      Skips the next item or set to first item in the list. If the looping is disabled, it will not set to first item and return nul
      Parameters:
      playlist -
      index - : if it's -1, plays the next item, otherwise it plays the item that is in the index
      Returns:
      Broadcast object for the next item. If it's not looping, it will return null
    • scheduleStreamFetcherJob

      private void scheduleStreamFetcherJob()
    • isToBeStoppedAutomatically

      public boolean isToBeStoppedAutomatically(Broadcast broadcast)
    • controlStreamFetchers

      public void controlStreamFetchers(boolean restart)
    • getDatastore

      public DataStore getDatastore()
    • setDatastore

      public void setDatastore(DataStore datastore)
    • getStreamFetcherList

      public Map<String,StreamFetcher> getStreamFetcherList()
    • getStreamFetcher

      public StreamFetcher getStreamFetcher(String streamId)
    • setStreamFetcherList

      public void setStreamFetcherList(Map<String,StreamFetcher> streamFetcherList)
    • isRestartStreamAutomatically

      public boolean isRestartStreamAutomatically()
    • setRestartStreamAutomatically

      public void setRestartStreamAutomatically(boolean restartStreamAutomatically)
    • getStreamCheckerCount

      public int getStreamCheckerCount()
    • setStreamCheckerCount

      public void setStreamCheckerCount(int streamCheckerCount)
    • stopPlayList

      public Result stopPlayList(String streamId)