Class SubtitlesView

java.lang.Object
android.view.View
com.castlabs.sdk.base.subtitles.SubtitlesView
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback

public class SubtitlesView extends View
  • Constructor Details

    • SubtitlesView

      public SubtitlesView(@NonNull Context context)
    • SubtitlesView

      public SubtitlesView(Context context, @Nullable AttributeSet attrs)
    • SubtitlesView

      public SubtitlesView(Context context, @Nullable AttributeSet attrs, int defStyleAttr)
    • SubtitlesView

      public SubtitlesView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes)
  • Method Details

    • setJNIHelper

      public void setJNIHelper(SubtitleParserHelper jniHelper)
    • setImagePool

      public void setImagePool(ImagePool imagePool)
    • onStyleChange

      public void onStyleChange(com.castlabs.subtitles.presentation.SubtitlesStyle overrideStyle)
      Set the user settings that override or customise the subtitles appearance
      Parameters:
      overrideStyle - Subtitle style to set
    • setDebugRendering

      public void setDebugRendering(boolean enabled)
      Enable or disable debug rendering
      Parameters:
      enabled - Enable or disable debug rendering
    • onDraw

      protected void onDraw(Canvas canvas)
      Overrides:
      onDraw in class View
    • onSizeChanged

      protected void onSizeChanged(int w, int h, int oldw, int oldh)
      Overrides:
      onSizeChanged in class View
    • setMeasuredVideoDimensions

      public void setMeasuredVideoDimensions(int width, int height)
      Informs the subtitle render context about the video dimensions. This is usually the video Surface dimensions.
      Parameters:
      width - width in pixels
      height - height in pixels
    • parse

      public void parse(String mimeType, String subtitlesContent, String baseUrl, long positionOffsetUs) throws Exception
      Throws:
      Exception
    • parse

      public void parse(String mimeType, byte[] subtitlesContent, String baseUrl, long positionOffsetUs) throws Exception
      Throws:
      Exception
    • update

      public void update(long playerPositionUs)
      Check for visibility changes to any of the subtitles If any subtitle changes state to become hidden or visible then the view will be rendered
      Parameters:
      playerPositionUs - The target position in microseconds