// Audio Player import React, { useEffect, useRef } from 'react'; import H5AudioPlayer from 'react-h5-audio-player'; import { useTheme } from 'styled-components'; import { useEncryptedFileFetch } from '../../hooks/useEncryptedFileFetch'; import { SessionIcon, SessionIconSize, SessionIconType } from '../session/icon'; export const AudioPlayerWithEncryptedFile = (props: { src: string; contentType: string; playbackSpeed: number; }) => { const theme = useTheme(); const { urlToLoad } = useEncryptedFileFetch(props.src, props.contentType); const { playbackSpeed } = props; const player = useRef(null); useEffect(() => { // updates playback speed to value selected in context menu if (player.current?.audio.current?.playbackRate) { player.current.audio.current.playbackRate = playbackSpeed; } }, [playbackSpeed]); return ( ), pause: ( ), }} /> ); };