|
|
|
@ -11,7 +11,7 @@ export interface IAudioPlayerRef {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default forwardRef(function AudioPlayer(
|
|
|
|
|
{ src, autoPlay }: { src?: string; autoPlay?: boolean },
|
|
|
|
|
{ src, autoPlay, onEnded }: { src?: string; autoPlay?: boolean; onEnded?: () => void },
|
|
|
|
|
ref: React.Ref<IAudioPlayerRef>,
|
|
|
|
|
) {
|
|
|
|
|
const [curTime, setCurTime] = useState('00:00');
|
|
|
|
@ -45,6 +45,10 @@ export default forwardRef(function AudioPlayer(
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleEnded = () => {
|
|
|
|
|
onEnded?.();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSlideStart = () => {
|
|
|
|
|
isDragingRef.current = true;
|
|
|
|
|
};
|
|
|
|
@ -86,6 +90,7 @@ export default forwardRef(function AudioPlayer(
|
|
|
|
|
src={src}
|
|
|
|
|
onLoadedMetadata={handleLoadedMetadata}
|
|
|
|
|
onTimeUpdate={handleTimeUpdate}
|
|
|
|
|
onEnded={handleEnded}
|
|
|
|
|
/>
|
|
|
|
|
<input
|
|
|
|
|
ref={sliderRef}
|
|
|
|
|