mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Replace Util.SDK_INT with Build.VERSION.SDK_INT in the demo app
Util.SDK_INT will not be part of the stable API. This change only touches those parts of the main demo app that will not be opted-in to the unstable API for other reasons (e.g. download use-cases). PiperOrigin-RevId: 437777687
This commit is contained in:
parent
2a2873840d
commit
e4556d76a9
1 changed files with 6 additions and 5 deletions
|
|
@ -17,6 +17,7 @@ package androidx.media3.demo.main;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
@ -142,7 +143,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
if (Util.SDK_INT > 23) {
|
if (Build.VERSION.SDK_INT > 23) {
|
||||||
initializePlayer();
|
initializePlayer();
|
||||||
if (playerView != null) {
|
if (playerView != null) {
|
||||||
playerView.onResume();
|
playerView.onResume();
|
||||||
|
|
@ -153,7 +154,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (Util.SDK_INT <= 23 || player == null) {
|
if (Build.VERSION.SDK_INT <= 23 || player == null) {
|
||||||
initializePlayer();
|
initializePlayer();
|
||||||
if (playerView != null) {
|
if (playerView != null) {
|
||||||
playerView.onResume();
|
playerView.onResume();
|
||||||
|
|
@ -164,7 +165,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (Util.SDK_INT <= 23) {
|
if (Build.VERSION.SDK_INT <= 23) {
|
||||||
if (playerView != null) {
|
if (playerView != null) {
|
||||||
playerView.onPause();
|
playerView.onPause();
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +176,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
if (Util.SDK_INT > 23) {
|
if (Build.VERSION.SDK_INT > 23) {
|
||||||
if (playerView != null) {
|
if (playerView != null) {
|
||||||
playerView.onPause();
|
playerView.onPause();
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +343,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||||
|
|
||||||
MediaItem.DrmConfiguration drmConfiguration = mediaItem.localConfiguration.drmConfiguration;
|
MediaItem.DrmConfiguration drmConfiguration = mediaItem.localConfiguration.drmConfiguration;
|
||||||
if (drmConfiguration != null) {
|
if (drmConfiguration != null) {
|
||||||
if (Util.SDK_INT < 18) {
|
if (Build.VERSION.SDK_INT < 18) {
|
||||||
showToast(R.string.error_drm_unsupported_before_api_18);
|
showToast(R.string.error_drm_unsupported_before_api_18);
|
||||||
finish();
|
finish();
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue