com.google.android.exoplayer.text.CaptionStyleCompat Java Examples

The following examples show how to use com.google.android.exoplayer.text.CaptionStyleCompat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RichTvInputService.java    From androidtv-sample-inputs with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateOverlayView() {
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    mSubtitleView = (SubtitleLayout) inflater.inflate(R.layout.subtitleview, null);

    // Configure the subtitle view.
    CaptionStyleCompat captionStyle;
    float captionTextSize = getCaptionFontSize();
    captionStyle = CaptionStyleCompat
            .createFromCaptionStyle(mCaptioningManager.getUserStyle());
    captionTextSize *= mCaptioningManager.getFontScale();
    mSubtitleView.setStyle(captionStyle);
    mSubtitleView.setFixedTextSize(TEXT_UNIT_PIXELS, captionTextSize);
    mSubtitleView.setVisibility(View.VISIBLE);

    return mSubtitleView;
}
 
Example #2
Source File: VideoPlayerActivity.java    From droidkaigi2016 with Apache License 2.0 5 votes vote down vote up
private void configureSubtitleView() {
    CaptionStyleCompat style;
    float fontScale;
    if (Util.SDK_INT >= 19) {
        style = getUserCaptionStyleV19();
        fontScale = getUserCaptionFontScaleV19();
    } else {
        style = CaptionStyleCompat.DEFAULT;
        fontScale = 1.0f;
    }
    subtitleLayout.setStyle(style);
    subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
 
Example #3
Source File: PlayerActivity.java    From Android-Example-HLS-ExoPlayer with Apache License 2.0 5 votes vote down vote up
private void configureSubtitleView() {
    CaptionStyleCompat style;
    float fontScale;
    if (Util.SDK_INT >= 19) {
        style = getUserCaptionStyleV19();
        fontScale = getUserCaptionFontScaleV19();
    } else {
        style = CaptionStyleCompat.DEFAULT;
        fontScale = 1.0f;
    }
    subtitleLayout.setStyle(style);
    subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
 
Example #4
Source File: VideoPlayerView.java    From iview-android-tv with MIT License 5 votes vote down vote up
public void configureSubtitleView() {
    CaptionStyleCompat captionStyle;
    float captionFontScale;
    if (Util.SDK_INT >= 19) {
        captionStyle = getUserCaptionStyleV19();
        captionFontScale = getUserCaptionFontScaleV19();
    } else {
        captionStyle = CaptionStyleCompat.DEFAULT;
        captionFontScale = 1.0f;
    }
    subtitleLayout.setStyle(captionStyle);
    subtitleLayout.setFontScale(captionFontScale);
}
 
Example #5
Source File: PlayerActivity.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
private void configureSubtitleView() {
  CaptionStyleCompat captionStyle;
  float captionTextSize = getCaptionFontSize();
  if (Util.SDK_INT >= 19) {
    captionStyle = getUserCaptionStyleV19();
    captionTextSize *= getUserCaptionFontScaleV19();
  } else {
    captionStyle = CaptionStyleCompat.DEFAULT;
  }
  subtitleView.setStyle(captionStyle);
  subtitleView.setTextSize(captionTextSize);
}
 
Example #6
Source File: VideoPlayerActivity.java    From droidkaigi2016 with Apache License 2.0 5 votes vote down vote up
private void configureSubtitleView() {
    CaptionStyleCompat style;
    float fontScale;
    if (Util.SDK_INT >= 19) {
        style = getUserCaptionStyleV19();
        fontScale = getUserCaptionFontScaleV19();
    } else {
        style = CaptionStyleCompat.DEFAULT;
        fontScale = 1.0f;
    }
    subtitleLayout.setStyle(style);
    subtitleLayout.setFractionalTextSize(SubtitleLayout.DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
 
Example #7
Source File: VideoPlayerActivity.java    From droidkaigi2016 with Apache License 2.0 4 votes vote down vote up
@TargetApi(19)
private CaptionStyleCompat getUserCaptionStyleV19() {
    CaptioningManager captioningManager =
            (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE);
    return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
}
 
Example #8
Source File: PlayerActivity.java    From Android-Example-HLS-ExoPlayer with Apache License 2.0 4 votes vote down vote up
@TargetApi(19)
private CaptionStyleCompat getUserCaptionStyleV19() {
    CaptioningManager captioningManager =
            (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE);
    return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
}
 
Example #9
Source File: VideoPlayerView.java    From iview-android-tv with MIT License 4 votes vote down vote up
@TargetApi(19)
private CaptionStyleCompat getUserCaptionStyleV19() {
    CaptioningManager captioningManager =
            (CaptioningManager) mContext.getSystemService(Context.CAPTIONING_SERVICE);
    return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
}
 
Example #10
Source File: PlayerActivity.java    From Exoplayer_VLC with Apache License 2.0 4 votes vote down vote up
@TargetApi(19)
private CaptionStyleCompat getUserCaptionStyleV19() {
  CaptioningManager captioningManager =
      (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE);
  return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
}
 
Example #11
Source File: VideoPlayerActivity.java    From droidkaigi2016 with Apache License 2.0 4 votes vote down vote up
@TargetApi(19)
private CaptionStyleCompat getUserCaptionStyleV19() {
    CaptioningManager captioningManager =
            (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE);
    return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
}