Skip to content

Commit

Permalink
iOS Sidecar loading for captions and offline support (isAsset). Android
Browse files Browse the repository at this point in the history
fix to respect User settings for captions.
  • Loading branch information
ashnfb committed Jul 5, 2018
1 parent d3d1947 commit 3e2e16e
Show file tree
Hide file tree
Showing 4 changed files with 295 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.accessibility.CaptioningManager;
import android.widget.FrameLayout;

import com.brentvatne.react.R;
Expand Down Expand Up @@ -759,7 +760,14 @@ public void setSelectedTextTrack(String type, Dynamic value) {
trackIndex = value.asInt();
} else { // default. invalid type or "system"
trackSelector.clearSelectionOverrides(index);
return;
trackSelector.setSelectionOverride(index, groups, null);

int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk>18 && groups.length>0) {
CaptioningManager captioningManager = (CaptioningManager) themedReactContext.getSystemService(Context.CAPTIONING_SERVICE);
if (captioningManager.isEnabled()) trackIndex=0;
} else return;

}

if (trackIndex == C.INDEX_UNSET) {
Expand Down
Loading

0 comments on commit 3e2e16e

Please sign in to comment.