From 11584f28d1374e49b44b1b1fcc2d5ce0e7b5c0eb Mon Sep 17 00:00:00 2001 From: Hampton Maxwell Date: Mon, 4 Jun 2018 11:48:59 -0700 Subject: [PATCH] Apply initial text track prop when the video is loaded --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 5f1585ed..a6e88409 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -104,6 +104,8 @@ class ReactExoplayerView extends FrameLayout implements private Uri srcUri; private String extension; private boolean repeat; + private String textTrackType; + private Dynamic textTrackValue; private boolean disableFocus; private float mProgressUpdateInterval = 250.0f; private boolean playInBackground = false; @@ -449,6 +451,7 @@ class ReactExoplayerView extends FrameLayout implements private void videoLoaded() { if (loadVideoStarted) { loadVideoStarted = false; + setSelectedTextTrack(textTrackType, textTrackValue); Format videoFormat = player.getVideoFormat(); int width = videoFormat != null ? videoFormat.width : 0; int height = videoFormat != null ? videoFormat.height : 0; @@ -643,6 +646,9 @@ class ReactExoplayerView extends FrameLayout implements } public void setSelectedTextTrack(String type, Dynamic value) { + textTrackType = type; + textTrackValue = value; + int index = getTextTrackRendererIndex(); if (index == C.INDEX_UNSET) { return;