1- import { useState , useCallback , useEffect , useRef } from "react" ;
1+ import { useState , useEffect , useRef } from "react" ;
22import { getArtistPreview } from "../../../utils/api" ;
33
44const SNAP_BACK_MS = 320 ;
@@ -22,13 +22,6 @@ export function usePreviewPlayer(mbid, artistNameFromNav, artist) {
2222 const previewAudioRef = useRef ( null ) ;
2323 const previewTickRef = useRef ( null ) ;
2424 const snapBackTimeoutRef = useRef ( null ) ;
25- const setPreviewAudioElement = useCallback (
26- ( node ) => {
27- previewAudioRef . current = node ;
28- if ( node ) node . volume = previewVolume ;
29- } ,
30- [ previewVolume ] ,
31- ) ;
3225
3326 useEffect ( ( ) => {
3427 const name = artistNameFromNav || artist ?. name ;
@@ -54,7 +47,6 @@ export function usePreviewPlayer(mbid, artistNameFromNav, artist) {
5447 const handlePreviewPlay = ( track ) => {
5548 const audio = previewAudioRef . current ;
5649 if ( ! audio || ! track . preview_url ) return ;
57- audio . volume = previewVolume ;
5850 if ( playingPreviewId === track . id ) {
5951 if ( audio . paused ) {
6052 if ( snapBackTimeoutRef . current )
@@ -166,7 +158,7 @@ export function usePreviewPlayer(mbid, artistNameFromNav, artist) {
166158 previewSnappingBack,
167159 previewVolume,
168160 setPreviewVolume,
169- previewAudioRef : setPreviewAudioElement ,
161+ previewAudioRef,
170162 handlePreviewPlay,
171163 } ;
172164}
0 commit comments