diff --git a/web/media/encrypted-multimedia.react.js b/web/media/encrypted-multimedia.react.js --- a/web/media/encrypted-multimedia.react.js +++ b/web/media/encrypted-multimedia.react.js @@ -7,7 +7,7 @@ import type { EncryptedMediaType } from 'lib/types/media-types.js'; -import { fetchAndDecryptMedia } from './encryption-utils.js'; +import { useFetchAndDecryptMedia } from './encryption-utils.js'; import LoadableVideo from './loadable-video.react.js'; import css from './media.css'; import LoadingIndicator from '../loading-indicator.react.js'; @@ -43,6 +43,8 @@ const [source, setSource] = React.useState(null); const videoRef = React.useRef(null); + const fetchAndDecryptMedia = useFetchAndDecryptMedia(); + React.useEffect(() => { let isMounted = true, uriToDispose; @@ -71,7 +73,7 @@ URL.revokeObjectURL(uriToDispose); } }; - }, [blobURI, encryptionKey]); + }, [blobURI, encryptionKey, fetchAndDecryptMedia]); // we need to update the video source when the source changes // because re-rendering the element wouldn't reload parent