The track is successfully added into a queue and playing but after dragging multiple times like left or right the track shows it playing but the sound is not coming from the speaker when I press pause and then play everything works fine like the track is playing and sound is coming from the speaker.
testing on IOS!
here is the code step-by-step
Describe the Bug
The track is successfully added into a queue and playing but after dragging multiple times like left or right the track shows it playing but the sound is not coming from the speaker when I press pause and then play everything works fine like the track is playing and sound is coming from the speaker. testing on IOS! here is the code step-by-step
Steps To Reproduce
step 1: adding tracks into the queue
const setUpTrackPlayer = async () => { try { setisLoading(true) const findIndex = AudioTracksLists.findIndex(val => val.id == EPI_OBJ.id); await TrackPlayer.reset(); await TrackPlayer.add(AudioTracksLists); const queue = await TrackPlayer.getQueue(); if (queue && queue.length > findIndex) { const selectedTrack = queue[findIndex]; await TrackPlayer.skip(findIndex); await TrackPlayer.play(); const isTrackPlayed = await TrackPlayer.getPlayWhenReady(); setisLoading(false); setisPlaying(isTrackPlayed); dispatch(EpisodsDataAction(BOOK_DATA)); dispatch(AudioPlayingAction(true)); console.log('audio is playing --->>>> '); } else { dispatch(AudioPlayingAction(false)); setisPlaying(false); setisLoading(false); console.log('audio is NOT playing --->>>> '); } } catch (e) { console.log( '🚀 🚀 ~ file: AudioPlayer.js:273 ~ setUpTrackPlayer ~ e:', e, ); } };
Step 2 :
const progress = useProgress();
const updateProgressPositionValue = parseInt(progress?.position?.toFixed(0));
const onSeekTo = async v => { const updateValue = parseInt(v?.toFixed(0)); try { setisLoading(true); await TrackPlayer.pause(); await TrackPlayer.seekTo(updateValue); setProgressPositionValue(updateValue); await TrackPlayer.play(); const isReady = await TrackPlayer.getPlayWhenReady(); setisLoading(false); setisPlaying(true); } catch (error) { console.log( '🚀 🚀 ~ file: AudioPlayer.js:160 ~ onSeekTo ~ error:', error, ); } };
useEffect(() => { setProgressPositionValue(updateProgressPositionValue); }, [updateProgressPositionValue]);
Library info : "react-native": "0.69.5", "react": "18.0.0", "@react-native-community/slider": "^4.3.1", "react-native-track-player": "4.0.1",