Interface MediaSource

    • Method Detail

      • addEventListener

        void addEventListener​(Handler handler,
                              MediaSourceEventListener eventListener)
        Deprecated.
        Adds a MediaSourceEventListener to the list of listeners which are notified of media source events.

        Should not be called directly from application code.

        This method must be called on the playback thread.

        Parameters:
        handler - A handler on the which listener events will be posted.
        eventListener - The listener to be added.
      • removeEventListener

        void removeEventListener​(MediaSourceEventListener eventListener)
        Deprecated.
        Removes a MediaSourceEventListener from the list of listeners which are notified of media source events.

        Should not be called directly from application code.

        This method must be called on the playback thread.

        Parameters:
        eventListener - The listener to be removed.
      • addDrmEventListener

        void addDrmEventListener​(Handler handler,
                                 DrmSessionEventListener eventListener)
        Deprecated.
        Adds a DrmSessionEventListener to the list of listeners which are notified of DRM events for this media source.

        Should not be called directly from application code.

        This method must be called on the playback thread.

        Parameters:
        handler - A handler on the which listener events will be posted.
        eventListener - The listener to be added.
      • removeDrmEventListener

        void removeDrmEventListener​(DrmSessionEventListener eventListener)
        Deprecated.
        Removes a DrmSessionEventListener from the list of listeners which are notified of DRM events for this media source.

        Should not be called directly from application code.

        This method must be called on the playback thread.

        Parameters:
        eventListener - The listener to be removed.
      • getInitialTimeline

        @Nullable
        default Timeline getInitialTimeline()
        Deprecated.
        Returns the initial placeholder timeline that is returned immediately when the real timeline is not yet known, or null to let the player create an initial timeline.

        Should not be called directly from application code.

        The initial timeline must use the same uids for windows and periods that the real timeline will use. It also must provide windows which are marked as dynamic to indicate that the window is expected to change when the real timeline arrives.

        Any media source which has multiple windows should typically provide such an initial timeline to make sure the player reports the correct number of windows immediately.

        This method must be called on the application thread.

      • isSingleWindow

        default boolean isSingleWindow()
        Deprecated.
        Returns true if the media source is guaranteed to never have zero or more than one window.

        Should not be called directly from application code.

        The default implementation returns true.

        This method must be called on the application thread.

        Returns:
        true if the source has exactly one window.
      • getMediaItem

        MediaItem getMediaItem()
        Deprecated.
        Returns the MediaItem whose media is provided by the source.

        Should not be called directly from application code.

        This method must be called on the application thread.

      • createPeriod

        MediaPeriod createPeriod​(MediaSource.MediaPeriodId id,
                                 Allocator allocator,
                                 long startPositionUs)
        Deprecated.
        Returns a new MediaPeriod identified by periodId.

        Should not be called directly from application code.

        This method must be called on the playback thread and only if the source is enabled.

        Parameters:
        id - The identifier of the period.
        allocator - An Allocator from which to obtain media buffer allocations.
        startPositionUs - The expected start position, in microseconds.
        Returns:
        A new MediaPeriod.
      • releasePeriod

        void releasePeriod​(MediaPeriod mediaPeriod)
        Deprecated.
        Releases the period.

        Should not be called directly from application code.

        This method must be called on the playback thread.

        Parameters:
        mediaPeriod - The period to release.