Fix build issues
This commit is contained in:
parent
2f77765fe2
commit
142521bc0e
@ -523,23 +523,24 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
es.execute(new Runnable() {
|
es.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// DRM initialization must run on a different thread
|
// DRM initialization must run on a different thread
|
||||||
initializePlayerDrm(self);
|
DRMSessionManager drmSessionManager = initializePlayerDrm(self);
|
||||||
|
if (drmSessionManager == null) {
|
||||||
|
// Failed to intialize DRM session manager - cannot continue
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Initialize handler to run on the main thread
|
// Initialize handler to run on the main thread
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable () {
|
new Handler(Looper.getMainLooper()).post(new Runnable () {
|
||||||
@Override
|
@Override
|
||||||
public void run () {
|
public void run () {
|
||||||
// Source initialization must run on the main thread
|
// Source initialization must run on the main thread
|
||||||
initializePlayerSource(self);
|
initializePlayerSource(self, drmSessionManager);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
initializePlayerSource(self);
|
initializePlayerSource(self, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -592,27 +593,24 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
player.setPlaybackParameters(params);
|
player.setPlaybackParameters(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializePlayerDrm(ReactExoplayerView self) {
|
private DrmSessionManager initializePlayerDrm(ReactExoplayerView self) {
|
||||||
DrmSessionManager drmSessionManager = null;
|
DrmSessionManager drmSessionManager = null;
|
||||||
if (self.drmUUID != null) {
|
if (self.drmUUID != null) {
|
||||||
try {
|
try {
|
||||||
drmSessionManager = buildDrmSessionManager(self.drmUUID, self.drmLicenseUrl,
|
drmSessionManager = self.buildDrmSessionManager(self.drmUUID, self.drmLicenseUrl,
|
||||||
self.drmLicenseHeader);
|
self.drmLicenseHeader);
|
||||||
} catch (UnsupportedDrmException e) {
|
} catch (UnsupportedDrmException e) {
|
||||||
int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported
|
int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported
|
||||||
: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
|
: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
|
||||||
? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown);
|
? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown);
|
||||||
eventEmitter.error(getResources().getString(errorStringId), e, "3003");
|
eventEmitter.error(getResources().getString(errorStringId), e, "3003");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drmSessionManager == null) {
|
return drmSessionManager;
|
||||||
// DRM Session Manager failed to instantiate, no other work can be done - error has been handled by the instantiating method
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializePlayerSource(ReactExoplayerView self) {
|
private void initializePlayerSource(ReactExoplayerView self, DrmSessionManager drmSessionManager) {
|
||||||
ArrayList<MediaSource> mediaSourceList = buildTextSources();
|
ArrayList<MediaSource> mediaSourceList = buildTextSources();
|
||||||
MediaSource videoSource = buildMediaSource(srcUri, extension, drmSessionManager);
|
MediaSource videoSource = buildMediaSource(srcUri, extension, drmSessionManager);
|
||||||
MediaSource mediaSource;
|
MediaSource mediaSource;
|
||||||
@ -666,10 +664,10 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
mediaDrm.setPropertyString("securityLevel", "L3");
|
mediaDrm.setPropertyString("securityLevel", "L3");
|
||||||
}
|
}
|
||||||
return new DefaultDrmSessionManager(uuid, mediaDrm, drmCallback, null, false, 3);
|
return new DefaultDrmSessionManager(uuid, mediaDrm, drmCallback, null, false, 3);
|
||||||
} catch(UnsupportedDrmException e) {
|
} catch(UnsupportedDrmException ex) {
|
||||||
// Unsupported DRM exceptions are handled by the calling method
|
// Unsupported DRM exceptions are handled by the calling method
|
||||||
throw e;
|
throw ex;
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
if (retryCount < 3) {
|
if (retryCount < 3) {
|
||||||
// Attempt retry 3 times in case where the OS Media DRM Framework fails for whatever reason
|
// Attempt retry 3 times in case where the OS Media DRM Framework fails for whatever reason
|
||||||
return buildDrmSessionManager(uuid, licenseUrl, keyRequestPropertiesArray, ++retryCount);
|
return buildDrmSessionManager(uuid, licenseUrl, keyRequestPropertiesArray, ++retryCount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user