fix createf instead use useRef for h5 audio player

This commit is contained in:
Audric Ackermann 2021-06-21 15:36:12 +10:00
parent 013df7fa2c
commit 34835ef68f
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
// Audio Player
import React, { createRef, useEffect } from 'react';
import React, { useEffect, useRef } from 'react';
import H5AudioPlayer from 'react-h5-audio-player';
import { useTheme } from 'styled-components';
import { useEncryptedFileFetch } from '../../hooks/useEncryptedFileFetch';
@ -13,7 +13,7 @@ export const AudioPlayerWithEncryptedFile = (props: {
const theme = useTheme();
const { urlToLoad } = useEncryptedFileFetch(props.src, props.contentType);
const { playbackSpeed } = props;
const player = createRef<H5AudioPlayer>();
const player = useRef<H5AudioPlayer | null>(null);
useEffect(() => {
// updates playback speed to value selected in context menu