Commit 6841d40b by krocard Committed by Oliver Woodman

Demo app: Do not allow tunneling on API < 21

Without this patch, enabling tunneling on an API < 21 device
would result in an method not existing exception and the
app would crash.

PiperOrigin-RevId: 275428851
parent 16a6946f
......@@ -206,7 +206,7 @@ public class PlayerActivity extends AppCompatActivity
DefaultTrackSelector.ParametersBuilder builder =
new DefaultTrackSelector.ParametersBuilder(/* context= */ this);
boolean tunneling = intent.getBooleanExtra(TUNNELING, false);
if (tunneling) {
if (Util.SDK_INT >= 21 && tunneling) {
builder.setTunnelingAudioSessionId(C.generateAudioSessionIdV21(/* context= */ this));
}
trackSelectorParameters = builder.build();
......
......@@ -127,6 +127,9 @@ public class SampleChooserActivity extends AppCompatActivity
preferExtensionDecodersMenuItem.setVisible(useExtensionRenderers);
randomAbrMenuItem = menu.findItem(R.id.random_abr);
tunnelingMenuItem = menu.findItem(R.id.tunneling);
if (Util.SDK_INT < 21) {
tunnelingMenuItem.setEnabled(false);
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment