Class AbstractStreamingEventListener

  • All Implemented Interfaces:
    StreamingEventListener

    public abstract class AbstractStreamingEventListener
    extends Object
    implements StreamingEventListener
    Abstract implementation of the StreamingEventListener. All methods of the the StreamingEventListener are implemented with empty bodies and you can extend this class if you only need to implement a subset of the callbacks. Using this abstract class instead of the interface might also simplify updates of the API.

    *NOTE* that all listener methods are invoked on the UI/main thread of your applications. You can directly interact with UI components from within the implementation of you listener.

    Since:
    3.1.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onLoadCanceled​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int dataType, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long bytesLoaded, long loadDurationMs, int currentAttempt, int maxAttempts)
      Invoked when the current upstream load operation is canceled.
      void onLoadCompleted​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int type, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long bytesLoaded, long loadDurationMs, int currentAttempt, int maxAttempts)
      Invoked when a load operation completes.
      void onLoadError​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int dataType, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long bytesLoaded, long loadDurationMs, int currentAttempt, int maxAttempts, DownloadException downloadException)
      Invoked when the current upstream load operation fails.
      void onLoadStarted​(com.google.android.exoplayer2.upstream.DataSpec dataSpec, int type, int trackType, int trigger, com.google.android.exoplayer2.Format format, long mediaStartTimeMs, long mediaEndTimeMs, int currentAttempt, int maxAttempts)
      Invoked when an upstream load is started.
      void onUpstreamDiscarded​(int trackType, long mediaStartTimeMs, long mediaEndTimeMs)
      Invoked when data is removed from the back of the buffer, typically so that it can be re-buffered using a different representation.
    • Constructor Detail

      • AbstractStreamingEventListener

        public AbstractStreamingEventListener()
    • Method Detail

      • onLoadCompleted

        public void onLoadCompleted​(@NonNull
                                    com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                                    int type,
                                    int trackType,
                                    int trigger,
                                    @Nullable
                                    com.google.android.exoplayer2.Format format,
                                    long mediaStartTimeMs,
                                    long mediaEndTimeMs,
                                    long elapsedRealtimeMs,
                                    long bytesLoaded,
                                    long loadDurationMs,
                                    int currentAttempt,
                                    int maxAttempts)
        Description copied from interface: StreamingEventListener
        Invoked when a load operation completes.
        Specified by:
        onLoadCompleted in interface StreamingEventListener
        Parameters:
        dataSpec - Defines the data being loaded.
        type - One of the C DATA_TYPE_* constants defining the type of data being loaded.
        trackType - The type of the track that triggered the load. One of PlayerController.VIDEO_RENDERER, PlayerController.AUDIO_RENDERER, or PlayerController.TEXT_RENDERER or -1 if not specified
        trigger - One of the C SELECTION_REASON_* constants if the data belongs to a track. C.SELECTION_REASON_UNKNOWN otherwise.
        format - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        mediaStartTimeMs - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        mediaEndTimeMs - The media time of the end of the loaded data, or -1 if this load was for initialization data.
        elapsedRealtimeMs - elapsedRealtime timestamp of when the load finished.
        bytesLoaded - The number of bytes that were loaded.
        loadDurationMs - Amount of time taken to load the data.
        currentAttempt - The attempt number for the load operation.
        maxAttempts - Maximum number of attempts for the load operation.
      • onLoadStarted

        public void onLoadStarted​(@NonNull
                                  com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                                  int type,
                                  int trackType,
                                  int trigger,
                                  @Nullable
                                  com.google.android.exoplayer2.Format format,
                                  long mediaStartTimeMs,
                                  long mediaEndTimeMs,
                                  int currentAttempt,
                                  int maxAttempts)
        Description copied from interface: StreamingEventListener
        Invoked when an upstream load is started.
        Specified by:
        onLoadStarted in interface StreamingEventListener
        Parameters:
        dataSpec - Defines the data being loaded.
        type - One of the C DATA_TYPE_* constants defining the type of data being loaded.
        trackType - The type of the track that triggered the load. One of PlayerController.VIDEO_RENDERER, PlayerController.AUDIO_RENDERER, or PlayerController.TEXT_RENDERER or -1 if not specified
        trigger - One of the C SELECTION_REASON_* constants if the data belongs to a track. C.SELECTION_REASON_UNKNOWN otherwise.
        format - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        mediaStartTimeMs - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        mediaEndTimeMs - The media time of the end of the loaded data, or -1 if this load was for
        currentAttempt - The attempt number for the load operation.
        maxAttempts - Maximum number of attempts for the load operation.
      • onLoadCanceled

        public void onLoadCanceled​(@NonNull
                                   com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                                   int dataType,
                                   int trackType,
                                   int trigger,
                                   @Nullable
                                   com.google.android.exoplayer2.Format format,
                                   long mediaStartTimeMs,
                                   long mediaEndTimeMs,
                                   long elapsedRealtimeMs,
                                   long bytesLoaded,
                                   long loadDurationMs,
                                   int currentAttempt,
                                   int maxAttempts)
        Description copied from interface: StreamingEventListener
        Invoked when the current upstream load operation is canceled.
        Specified by:
        onLoadCanceled in interface StreamingEventListener
        Parameters:
        dataSpec - Defines the data being loaded.
        dataType - One of the C DATA_TYPE_* constants defining the type of data being loaded.
        trackType - The type of the track that triggered the load. One of PlayerController.VIDEO_RENDERER, PlayerController.AUDIO_RENDERER, or PlayerController.TEXT_RENDERER or -1 if not specified
        trigger - One of the C SELECTION_REASON_* constants if the data belongs to a track. C.SELECTION_REASON_UNKNOWN otherwise.
        format - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        mediaStartTimeMs - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        mediaEndTimeMs - The media time of the end of the loaded data, or -1 if this load was for initialization data.
        elapsedRealtimeMs - elapsedRealtime timestamp of when the load finished.
        bytesLoaded - The number of bytes that were loaded.
        loadDurationMs - Amount of time taken to load the data.
        currentAttempt - The attempt number for the load operation.
        maxAttempts - Maximum number of attempts for the load operation.
      • onLoadError

        public void onLoadError​(@NonNull
                                com.google.android.exoplayer2.upstream.DataSpec dataSpec,
                                int dataType,
                                int trackType,
                                int trigger,
                                @Nullable
                                com.google.android.exoplayer2.Format format,
                                long mediaStartTimeMs,
                                long mediaEndTimeMs,
                                long elapsedRealtimeMs,
                                long bytesLoaded,
                                long loadDurationMs,
                                int currentAttempt,
                                int maxAttempts,
                                @Nullable
                                DownloadException downloadException)
        Description copied from interface: StreamingEventListener
        Invoked when the current upstream load operation fails.
        Specified by:
        onLoadError in interface StreamingEventListener
        Parameters:
        dataSpec - Defines the data being loaded.
        dataType - One of the C DATA_TYPE_* constants defining the type of data being loaded.
        trackType - The type of the track that triggered the load. One of PlayerController.VIDEO_RENDERER, PlayerController.AUDIO_RENDERER, or PlayerController.TEXT_RENDERER or -1 if not specified
        trigger - One of the C SELECTION_REASON_* constants if the data belongs to a track. C.SELECTION_REASON_UNKNOWN otherwise.
        format - The particular format to which this data corresponds, or null if the loaded data does not correspond to a format.
        mediaStartTimeMs - The media time of the start of the loaded data, or -1 if this load was for initialization data.
        mediaEndTimeMs - The media time of the end of the loaded data, or -1 if this load was for initialization data.
        elapsedRealtimeMs - elapsedRealtime timestamp of when the load finished.
        bytesLoaded - The number of bytes that were loaded.
        loadDurationMs - Amount of time taken to load the data.
        currentAttempt - The attempt number for the load operation.
        maxAttempts - Maximum number of attempts for the load operation.
        downloadException - (optional) Download exception that caused the error. If present, the cause refers to the underlying IOException and if available, the http status code will be exposed here.