Skip to content

Commit

Permalink
ar(feat) DPCP-31: Audio Player
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloreale committed Aug 4, 2024
1 parent 0286c1a commit f810b76
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/molecules/02_AudioPlayer/AudioPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,20 @@ export const HAudioPlayer = function ({

useEffect(() => {
const element = audioElement.current;
const handlePlay = handleStatus('playing', {
title: element.getAttribute('data-title') || prompt,
});
const handleStop = handleStatus('stopped', {});
element.addEventListener('play', handlePlay);
element.addEventListener('ended', handleStop);
if (element) {
const handlePlay = handleStatus('playing', {
title: element.getAttribute('data-title') || prompt,
});
const handleStop = handleStatus('stopped', {});
element.addEventListener('play', handlePlay);
element.addEventListener('ended', handleStop);

return () => {
element.removeEventListener('play', handlePlay);
element.removeEventListener('ended', handleStop);
};
return () => {
element.removeEventListener('play', handlePlay);
element.removeEventListener('ended', handleStop);
};
}
return () => {};
}, [status]);

Check warning on line 120 in src/molecules/02_AudioPlayer/AudioPlayer.tsx

View workflow job for this annotation

GitHub Actions / oneiros::publish::build

React Hook useEffect has missing dependencies: 'handleStatus' and 'prompt'. Either include them or remove the dependency array

Check warning on line 120 in src/molecules/02_AudioPlayer/AudioPlayer.tsx

View workflow job for this annotation

GitHub Actions / oneiros::publish::npm-publish

React Hook useEffect has missing dependencies: 'handleStatus' and 'prompt'. Either include them or remove the dependency array

return (
Expand Down

0 comments on commit f810b76

Please sign in to comment.