HomePhabricator
Diffusion Comm d392c7c61165

[web] Preload encrypted media

Description

[web] Preload encrypted media

Summary:
Resolves ENG-3679.
Used fetch to preload encrypted media. The current preloadImage function used to preload them by creating a dummy <img /> element and setting the src property, which was not suitable for encrypted media.

The introduced function in fact preloads any request, including images, but I left the original because browser might have some optimizations for images. Also it is used in other places in the codebase e.g. to get the dimensions.

Test Plan:
Entered an encrypted media chat and selected a photo to send. Observed the Dev Tools Network tab to see that the encrypted media was preloaded:

Screenshot 2023-06-01 at 08.35.07.png (216×1 px, 136 KB)

Note the two subsequent requests to b281...3d58. The first one is sent from the preload function (media-utils.js, 251ms), while the other is read from disk-cache. Remember to uncheck the "Disable cache" option in devtools.

Reviewers: atul, ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8050

Details

Provenance
bartekAuthored on May 31 2023, 11:40 PM
Reviewer
ashoat
Differential Revision
D8050: [web] Preload encrypted media
Parents
rCOMM6f4a1fb736a6: [native] Fix long names intersecting with the search button
Branches
Unknown
Tags
Unknown