Add disabled text track selection option

This commit is contained in:
Hampton Maxwell 2018-06-02 19:41:50 -07:00
parent b44ae2c0c2
commit 4d008e56f2

View File

@ -5,12 +5,14 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.media.AudioManager; import android.media.AudioManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.accessibility.CaptioningManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.brentvatne.react.R; import com.brentvatne.react.R;
@ -59,6 +61,7 @@ import java.net.CookieManager;
import java.net.CookiePolicy; import java.net.CookiePolicy;
import java.lang.Math; import java.lang.Math;
import java.lang.Object; import java.lang.Object;
import java.util.Locale;
@SuppressLint("ViewConstructor") @SuppressLint("ViewConstructor")
class ReactExoplayerView extends FrameLayout implements class ReactExoplayerView extends FrameLayout implements
@ -653,6 +656,9 @@ class ReactExoplayerView extends FrameLayout implements
int trackIndex = C.INDEX_UNSET; int trackIndex = C.INDEX_UNSET;
if (TextUtils.isEmpty(type)) { if (TextUtils.isEmpty(type)) {
// Do nothing // Do nothing
} else if (type.equals("disabled")) {
trackSelector.setSelectionOverride(index, groups, null);
return;
} else if (type.equals("language")) { } else if (type.equals("language")) {
for (int i = 0; i < groups.length; ++i) { for (int i = 0; i < groups.length; ++i) {
Format format = groups.get(i).getFormat(0); Format format = groups.get(i).getFormat(0);