-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IOS] Seek to right after playback changed doesn't work #1359
Comments
@GrimDev same issue here man. Works perfectly on android but not on iOS. I hope we can get a fix very soon. |
I have some weird position inconsistencies on iOS as well. On Android, everything works perfectly fine. This is an example log dump:
@GrimDev just like in your case - using |
Facing the same issue @GrimDev. Did you find any solution? |
Btw I'd be happy to provide more information/logs if needed :) |
Nope @rajivtiwary-cm, not really my highest priority now but still waiting for a workaround |
I haven't tried this solution for iOS myself yet, but others are saying that it works: #387 (comment) |
@martinmidtsund I've tried the patch suggested in the referenced issue, unfortunately, this didn't change anything for me. However, I can provide further information for this issue. I've now verified that |
@KochMario Ok, I am trying to implement this functionality that @GrimDev is describing (starting on previously saved position) and indeed having troubles with seekTo right after playing a new track. I tried hacking it with setting volume to 0 and seeking in interval until new position is verified, which works, but is not optimal. But with the given patch, it seems to work fine on iOS. Have not tested and verified that seekTo works fine on Android. I am not seeing any different behaviour on local files vs online files, and these are .mp3 files. This is perhaps the same issue as #713 will fix? |
So it's looking like this issue is going to need to be solved in order to complete this PR. With that said, I've been doing some investigation with @dcvz on what's causing the problem. It seems that it is related to the SwiftAudioEx project. Specifically, the loading of a new track is done asynchronously but seek is executed synchronously. If a seek is called after a skip but before the track loading is complete, then the resetting will occur. |
The fix to So once |
Great work @jspizziri and @dcvz 🙏 |
* chore(example): update the example project dependencies * docs(example): add some general documentation on working with the example app * chore(ios): upgrade the SwiftAudioEx library which fixes an issue with seek #1359
The above MR containing this fix landed in https://github.com/DoubleSymmetry/react-native-track-player/releases/tag/v2.2.0-rc1 @dcvz I feel like this issue can be safely closed for now. |
* chore(example): update the example project dependencies * docs(example): add some general documentation on working with the example app * chore(ios): upgrade the SwiftAudioEx library which fixes an issue with seek doublesymmetry/react-native-track-player#1359
Describe the bug
Hi there 👋.
In the eventListener
PlaybackTrackChanged
, callingTrackPlayer.seekTo()
on IOS does nothing while it works well on Android.I tried some workarounds but failed.
Note that I have a slider component that use seekTo and works well, the issue only appears when I try to seek to right after adding the track (or playing) even if, of course, I use
await
.Context
My app plays audio books. When a user pauses the audio or quits the app, I save the position of the current track in a database.
When he comes back later to the app, he is able to "continue" an audio book, restarting at the position he stops.
To make this possible, I need to seek to the last known position right after adding the track, ideally before it starts at the 0 position.
What I made works well on Android, but doesn't have any effect on iOS.
To Reproduce
Steps to reproduce the behavior:
PlaybackTrackChanged
eventListenerI also tried :
And :
Environment
react-native info
What
react-native-track-player
version are you using?2.1.2
Are you testing on a real device or in the simulator? Which OS version are you running?
Real iPhone SE v15.1
Code
The text was updated successfully, but these errors were encountered: