How to force caption support using Chromecast Companion Library

64 Views Asked by At

I am revamping my chromecast implementation to use the Companion Library (https://github.com/googlecast/CastCompanionLibrary-android)

Currently the only way to have the caption button visible on post KITKAT is to have the users enable captions through the accessibility settings on their device. Is there a way to force the caption button to be visible in VideoCastControllerActivity as our content is all international and 90% of the users will want subtitles.

TracksPreferenceManager (part of the companion library) uses the following code

@SuppressLint("NewApi")
public boolean isCaptionEnabled() {
    if (Utils.IS_KITKAT_OR_ABOVE) {
        CaptioningManager captioningManager =
                (CaptioningManager) mContext.getSystemService(Context.CAPTIONING_SERVICE);
        return captioningManager.isEnabled();
    } else {
        return mPreferenceAccessor.getBooleanFromPreference(
                mContext.getString(R.string.ccl_key_caption_enabled), false);
    }
}
0

There are 0 best solutions below