Skip to content

Commit

Permalink
fix: player
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardocasares committed Oct 28, 2020
1 parent 19cdb6d commit 3f22cc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/context/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export const PlayerProvider = ({ children }) => {
const [playing, setPlaying] = useState(false);
const [stopped, setStopped] = useState(false);

const play = (station: Station) => {
if (audio.current.src !== station.url) {
audio.current.src = station.url;
audio.current.play().then(() => setStation(station));
const play = (s: Station) => {
if (audio.current.src !== s.url) {
audio.current.src = s.url;
audio.current.play().then(() => setStation(s));
}

if (paused) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const PlayerProvider = ({ children }) => {
return () => {
audio.current.removeEventListener("playing", () => setPlaying(true));
};
});
}, []);

return (
<PlayerContext.Provider
Expand Down

0 comments on commit 3f22cc4

Please sign in to comment.