New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback if createImageBitmap(Blob)
is not supported
#9373
base: v7.x
Are you sure you want to change the base?
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit bb052a1:
|
|
||
return createImageBitmap(blob).then(() => true, () => false); | ||
return testImageFormat(avifData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we simply do new Image
here instead of blob/createImageBitmap? This PR seems like a lot of work to see if AVIF works. We are not trying to test if blob + createImageBitmap is supported only if the format is supported by the browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use Image
, because it isn't available in workers.
Description of change
According to this
createImageBitmap(Blob)
is not supported in Safari.canLoadImageBitmap()
, which tests ifloadImageBitmap()
is supported.Added thetestImageOrVideoFormat(dataURL)
helper to test if an image or video format it supported.Pre-Merge Checklist
npm run lint
)npm run test
)