Class TextRenderer

    • Constructor Detail

      • TextRenderer

        public TextRenderer​(TextOutput output,
                            @Nullable
                            Looper outputLooper)
        Parameters:
        output - The output.
        outputLooper - The looper associated with the thread on which the output should be called. If the output makes use of standard Android UI components, then this should normally be the looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called directly on the player's internal rendering thread.
      • TextRenderer

        public TextRenderer​(TextOutput output,
                            @Nullable
                            Looper outputLooper,
                            SubtitleDecoderFactory decoderFactory)
        Parameters:
        output - The output.
        outputLooper - The looper associated with the thread on which the output should be called. If the output makes use of standard Android UI components, then this should normally be the looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called directly on the player's internal rendering thread.
        decoderFactory - A factory from which to obtain SubtitleDecoder instances.
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Renderer
        Returns the name of this renderer, for logging and debugging purposes. Should typically be the renderer's (un-obfuscated) class name.
        Specified by:
        getName in interface Renderer
        Specified by:
        getName in interface RendererCapabilities
        Returns:
        The name of this renderer.
      • setFinalStreamEndPositionUs

        public void setFinalStreamEndPositionUs​(long streamEndPositionUs)
        Sets the position at which to stop rendering the current stream.

        Must be called after BaseRenderer.setCurrentStreamFinal().

        Parameters:
        streamEndPositionUs - The position to stop rendering at or C.LENGTH_UNSET to render until the end of the current stream.
      • onPositionReset

        protected void onPositionReset​(long positionUs,
                                       boolean joining)
        Description copied from class: BaseRenderer
        Called when the position is reset. This occurs when the renderer is enabled after BaseRenderer.onStreamChanged(Format[], long, long) has been called, and also when a position discontinuity is encountered.

        After a position reset, the renderer's SampleStream is guaranteed to provide samples starting from a key frame.

        The default implementation is a no-op.

        Overrides:
        onPositionReset in class BaseRenderer
        Parameters:
        positionUs - The new playback position in microseconds.
        joining - Whether this renderer is being enabled to join an ongoing playback.
      • onDisabled

        protected void onDisabled()
        Description copied from class: BaseRenderer
        Called when the renderer is disabled.

        The default implementation is a no-op.

        Overrides:
        onDisabled in class BaseRenderer
      • isEnded

        public boolean isEnded()
        Description copied from interface: Renderer
        Whether the renderer is ready for the ExoPlayer instance to transition to Player.STATE_ENDED. The player will make this transition as soon as true is returned by all of its renderers.

        This method may be called when the renderer is in the following states: Renderer.STATE_ENABLED, Renderer.STATE_STARTED.

        Specified by:
        isEnded in interface Renderer
        Returns:
        Whether the renderer is ready for the player to transition to the ended state.
      • isReady

        public boolean isReady()
        Description copied from interface: Renderer
        Whether the renderer is able to immediately render media from the current position.

        If the renderer is in the Renderer.STATE_STARTED state then returning true indicates that the renderer has everything that it needs to continue playback. Returning false indicates that the player should pause until the renderer is ready.

        If the renderer is in the Renderer.STATE_ENABLED state then returning true indicates that the renderer is ready for playback to be started. Returning false indicates that it is not.

        This method may be called when the renderer is in the following states: Renderer.STATE_ENABLED, Renderer.STATE_STARTED.

        Specified by:
        isReady in interface Renderer
        Returns:
        Whether the renderer is ready to render media.