diff --git a/plugin-hrm-form/src/components/contact/MediaSection/RecordingSection.tsx b/plugin-hrm-form/src/components/contact/MediaSection/RecordingSection.tsx index 3a676607a7..9160a66fb8 100644 --- a/plugin-hrm-form/src/components/contact/MediaSection/RecordingSection.tsx +++ b/plugin-hrm-form/src/components/contact/MediaSection/RecordingSection.tsx @@ -19,7 +19,8 @@ import CircularProgress from '@material-ui/core/CircularProgress'; import { ErrorFont, LoadMediaButton, LoadMediaButtonText } from './styles'; import { S3StoredRecording } from '../../../types/types'; -import { getFileDownloadUrl } from '../../../services/ServerlessService'; +import { generateExternalMediaPath } from '../../../services/ContactService'; +import fetchHrmApi from '../../../services/fetchHrmApi'; type OwnProps = { contactId: string; externalStoredRecording: S3StoredRecording }; @@ -34,11 +35,16 @@ const RecordingSection: React.FC = ({ contactId, externalStoredRecordi setLoading(true); setShowButton(false); - const recordingPreSignedUrl = await getFileDownloadUrl(externalStoredRecording.location.key); - const recordingResponse = await fetch(recordingPreSignedUrl.downloadUrl); - const recordingBlob = await recordingResponse.blob(); - const voiceRecording = new Audio(URL.createObjectURL(recordingBlob)); - setVoiceRecording(voiceRecording.src); + // TODO: this won't currently work for local dev env + const { media_url: recordingPreSignedUrl } = await fetchHrmApi( + generateExternalMediaPath( + contactId, + externalStoredRecording.location.bucket, + externalStoredRecording.location.key, + ), + ); + + setVoiceRecording(recordingPreSignedUrl); setLoading(false); } catch (error) { @@ -86,7 +92,7 @@ const RecordingSection: React.FC = ({ contactId, externalStoredRecordi return (
{voiceRecording ? ( -