fix(android): viewType is ignored when its value is ViewType.TEXTURE (#4031)

This commit is contained in:
Mickael Lecoq 2024-08-02 10:50:27 +02:00 committed by GitHub
parent 08a57a3ba3
commit 22cfd6cead
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -595,28 +595,32 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
const shallForceViewType = const shallForceViewType =
hasValidDrmProp && (viewType === ViewType.TEXTURE || useTextureView); hasValidDrmProp && (viewType === ViewType.TEXTURE || useTextureView);
if (shallForceViewType) {
console.warn(
'cannot use DRM on texture view. please set useTextureView={false}',
);
}
if (useSecureView && useTextureView) { if (useSecureView && useTextureView) {
console.warn( console.warn(
'cannot use SecureView on texture view. please set useTextureView={false}', 'cannot use SecureView on texture view. please set useTextureView={false}',
); );
} }
return shallForceViewType if (shallForceViewType) {
? useSecureView console.warn(
? ViewType.SURFACE_SECURE 'cannot use DRM on texture view. please set useTextureView={false}',
: ViewType.SURFACE // check if we should force the type to Surface due to DRM );
: viewType return useSecureView ? ViewType.SURFACE_SECURE : ViewType.SURFACE;
? viewType // else use ViewType from source }
: useSecureView // else infer view type from useSecureView and useTextureView
? ViewType.SURFACE_SECURE if (viewType !== undefined && viewType !== null) {
: useTextureView return viewType;
? ViewType.TEXTURE }
: ViewType.SURFACE;
if (useSecureView) {
return ViewType.SURFACE_SECURE;
}
if (useTextureView) {
return ViewType.TEXTURE;
}
return ViewType.SURFACE;
}, [drm, useSecureView, useTextureView, viewType]); }, [drm, useSecureView, useTextureView, viewType]);
const _renderPoster = useCallback(() => { const _renderPoster = useCallback(() => {