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],
|
[onAspectRatio],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const useExternalGetLicense = drm?.getLicense instanceof Function;
|
||||||
|
|
||||||
const onGetLicense = useCallback(
|
const onGetLicense = useCallback(
|
||||||
(event: NativeSyntheticEvent<OnGetLicenseData>) => {
|
(event: NativeSyntheticEvent<OnGetLicenseData>) => {
|
||||||
if (drm && drm.getLicense instanceof Function) {
|
if (useExternalGetLicense) {
|
||||||
const data = event.nativeEvent;
|
const data = event.nativeEvent;
|
||||||
if (data && data.spcBase64) {
|
if (data && data.spcBase64) {
|
||||||
const getLicenseOverride = drm.getLicense(
|
const getLicenseOverride = drm.getLicense(
|
||||||
@ -479,7 +481,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[drm],
|
[drm, useExternalGetLicense],
|
||||||
);
|
);
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
@ -521,7 +523,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
|||||||
selectedTextTrack={_selectedTextTrack}
|
selectedTextTrack={_selectedTextTrack}
|
||||||
selectedAudioTrack={_selectedAudioTrack}
|
selectedAudioTrack={_selectedAudioTrack}
|
||||||
selectedVideoTrack={_selectedVideoTrack}
|
selectedVideoTrack={_selectedVideoTrack}
|
||||||
onGetLicense={onGetLicense}
|
onGetLicense={useExternalGetLicense ? onGetLicense : undefined}
|
||||||
onVideoLoad={onVideoLoad}
|
onVideoLoad={onVideoLoad}
|
||||||
onVideoLoadStart={onVideoLoadStart}
|
onVideoLoadStart={onVideoLoadStart}
|
||||||
onVideoError={onVideoError}
|
onVideoError={onVideoError}
|
||||||
|
Loading…
Reference in New Issue
Block a user