Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/components/AudioPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import getDeviceEventNames from '../helpers/utils/getDeviceEventNames';
import './audioPlay.css';

export interface AudioInterface {
autoPlay?: boolean;
className?: string;
src: string;
loop?: boolean;
Expand All @@ -25,6 +26,7 @@ export interface AudioInterface {
}

export const AudioPlayer: React.FC<AudioInterface> = ({
autoPlay = false,
className = '',
src,
loop = false,
Expand Down Expand Up @@ -323,6 +325,10 @@ export const AudioPlayer: React.FC<AudioInterface> = ({
}
};

const handleOnPlay = () => {
setIsPlaying(true);
};

return (
<div
tabIndex={-1}
Expand Down Expand Up @@ -419,12 +425,14 @@ export const AudioPlayer: React.FC<AudioInterface> = ({
</div>

<audio
ref={audioRef}
loop={loop}
ref={audioRef}
preload={preload}
onCanPlay={handleCanPlay}
autoPlay={autoPlay}
onPlay={handleOnPlay}
onEnded={handleEnded}
onError={handleOnError}
onCanPlay={handleCanPlay}
onLoadedMetadata={handleLoadedMetaData}
onTimeUpdate={handleUpdateProgress}
onVolumeChange={handleUpdateVolume}
Expand Down