fix: inject onGetLicense prop properly for detect user defined or not (#3608)
* fix: inject onGetLicense prop properly for detect user defined or not * fix: fix lint error
This commit is contained in:
parent
0312afc8ea
commit
24c1aab3f5
@ -432,9 +432,11 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
[onAspectRatio],
|
||||
);
|
||||
|
||||
const useExternalGetLicense = drm?.getLicense instanceof Function;
|
||||
|
||||
const onGetLicense = useCallback(
|
||||
(event: NativeSyntheticEvent<OnGetLicenseData>) => {
|
||||
if (drm && drm.getLicense instanceof Function) {
|
||||
if (useExternalGetLicense) {
|
||||
const data = event.nativeEvent;
|
||||
if (data && data.spcBase64) {
|
||||
const getLicenseOverride = drm.getLicense(
|
||||
@ -479,7 +481,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
}
|
||||
}
|
||||
},
|
||||
[drm],
|
||||
[drm, useExternalGetLicense],
|
||||
);
|
||||
|
||||
useImperativeHandle(
|
||||
@ -521,7 +523,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
selectedTextTrack={_selectedTextTrack}
|
||||
selectedAudioTrack={_selectedAudioTrack}
|
||||
selectedVideoTrack={_selectedVideoTrack}
|
||||
onGetLicense={onGetLicense}
|
||||
onGetLicense={useExternalGetLicense ? onGetLicense : undefined}
|
||||
onVideoLoad={onVideoLoad}
|
||||
onVideoLoadStart={onVideoLoadStart}
|
||||
onVideoError={onVideoError}
|
||||
|
Loading…
Reference in New Issue
Block a user