|
|
|
@ -12,8 +12,8 @@ export const AudioPlayerWithEncryptedFile = (props: {
|
|
|
|
contentType: string;
|
|
|
|
contentType: string;
|
|
|
|
playbackSpeed: number;
|
|
|
|
playbackSpeed: number;
|
|
|
|
playNextMessage?: (index: number) => void;
|
|
|
|
playNextMessage?: (index: number) => void;
|
|
|
|
playableMessageIndex?: number
|
|
|
|
playableMessageIndex?: number;
|
|
|
|
nextMessageToPlay?: number
|
|
|
|
nextMessageToPlay?: number;
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const theme = useTheme();
|
|
|
|
const theme = useTheme();
|
|
|
|
const { urlToLoad } = useEncryptedFileFetch(props.src, props.contentType);
|
|
|
|
const { urlToLoad } = useEncryptedFileFetch(props.src, props.contentType);
|
|
|
|
@ -28,10 +28,10 @@ export const AudioPlayerWithEncryptedFile = (props: {
|
|
|
|
}, [playbackSpeed]);
|
|
|
|
}, [playbackSpeed]);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if (props.playableMessageIndex == props.nextMessageToPlay) {
|
|
|
|
if (props.playableMessageIndex === props.nextMessageToPlay) {
|
|
|
|
player.current?.audio.current?.play();
|
|
|
|
player.current?.audio.current?.play();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const onEnded = () => {
|
|
|
|
const onEnded = () => {
|
|
|
|
// if audio autoplay is enabled, call method to start playing
|
|
|
|
// if audio autoplay is enabled, call method to start playing
|
|
|
|
@ -43,7 +43,7 @@ export const AudioPlayerWithEncryptedFile = (props: {
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
props.playNextMessage(props.playableMessageIndex);
|
|
|
|
props.playNextMessage(props.playableMessageIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<H5AudioPlayer
|
|
|
|
<H5AudioPlayer
|
|
|
|
|