Chore(android): refactor drm props (#3846)
This commit is contained in:
@@ -110,6 +110,7 @@ import androidx.media3.ui.LegacyPlayerControlView;
|
||||
import com.brentvatne.common.api.BufferConfig;
|
||||
import com.brentvatne.common.api.BufferingStrategy;
|
||||
import com.brentvatne.common.api.ControlsConfig;
|
||||
import com.brentvatne.common.api.DRMProps;
|
||||
import com.brentvatne.common.api.ResizeMode;
|
||||
import com.brentvatne.common.api.SideLoadedTextTrack;
|
||||
import com.brentvatne.common.api.SideLoadedTextTrackList;
|
||||
@@ -238,9 +239,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
private float mProgressUpdateInterval = 250.0f;
|
||||
private boolean playInBackground = false;
|
||||
private boolean mReportBandwidth = false;
|
||||
private UUID drmUUID = null;
|
||||
private String drmLicenseUrl = null;
|
||||
private String[] drmLicenseHeader = null;
|
||||
private DRMProps drmProps;
|
||||
private boolean controls;
|
||||
private Uri adTagUrl;
|
||||
|
||||
@@ -774,10 +773,11 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
|
||||
private DrmSessionManager initializePlayerDrm(ReactExoplayerView self) {
|
||||
DrmSessionManager drmSessionManager = null;
|
||||
if (self.drmUUID != null) {
|
||||
if (self.drmProps != null) {
|
||||
try {
|
||||
drmSessionManager = self.buildDrmSessionManager(self.drmUUID, self.drmLicenseUrl,
|
||||
self.drmLicenseHeader);
|
||||
drmSessionManager = self.buildDrmSessionManager(self.drmProps.getDrmUUID(),
|
||||
self.drmProps.getDrmLicenseServer(),
|
||||
self.drmProps.getDrmLicenseHeader());
|
||||
} catch (UnsupportedDrmException e) {
|
||||
int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported
|
||||
: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
|
||||
@@ -794,7 +794,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
return;
|
||||
}
|
||||
DrmSessionManager drmSessionManager = initializePlayerDrm(this);
|
||||
if (drmSessionManager == null && drmUUID != null) {
|
||||
if (drmSessionManager == null && drmProps != null && drmProps.getDrmUUID() != null) {
|
||||
// Failed to intialize DRM session manager - cannot continue
|
||||
DebugLog.e(TAG, "Failed to initialize DRM Session Manager Framework!");
|
||||
eventEmitter.error("Failed to initialize DRM Session Manager Framework!", new Exception("DRM Session Manager Framework failure!"), "3003");
|
||||
@@ -2229,7 +2229,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
}
|
||||
|
||||
public void setUseTextureView(boolean useTextureView) {
|
||||
boolean finallyUseTextureView = useTextureView && this.drmUUID == null;
|
||||
boolean finallyUseTextureView = useTextureView && drmProps == null;
|
||||
exoPlayerView.setUseTextureView(finallyUseTextureView);
|
||||
}
|
||||
|
||||
@@ -2256,16 +2256,11 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
initializePlayer();
|
||||
}
|
||||
|
||||
public void setDrmType(UUID drmType) {
|
||||
this.drmUUID = drmType;
|
||||
}
|
||||
|
||||
public void setDrmLicenseUrl(String licenseUrl){
|
||||
this.drmLicenseUrl = licenseUrl;
|
||||
}
|
||||
|
||||
public void setDrmLicenseHeader(String[] header){
|
||||
this.drmLicenseHeader = header;
|
||||
public void setDrm(DRMProps drmProps) {
|
||||
this.drmProps = drmProps;
|
||||
if (drmProps != null && drmProps.getDrmType() != null) {
|
||||
this.drmProps.setDrmUUID(Util.getDrmUuid(drmProps.getDrmType()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user