After seeking, most of the time (not always), the progress bar on the lock screen in iOS will be incorrect. It continues to update and adjust the time, but the time and the progress shown in the bar is incorrect.
Progress reported and displayed within the app itself is correct.
Happens in my own app and when testing in the example.
Track player v1.0.0.
iPhone 7, iOS 12.0.1
iPad Pro, iOS 11.2.6
Added these lines to the example in order to test:
//PlaylistScreen.js
//added this to capabilities, in case it matters
TrackPlayer.CAPABILITY_SEEK_TO
//seek
seekToPercent = async (percent) => {
try {
let duration = await TrackPlayer.getDuration();
let time = duration * percent;
await TrackPlayer.seekTo(time);
} catch (_) {}
}
//in render
<Button title='Seek 20%' onPress={() => this.seekToPercent(0.2)} />
<Button title='Seek 40%' onPress={() => this.seekToPercent(0.4)} />
<Button title='Seek 60%' onPress={() => this.seekToPercent(0.6)} />
<Button title='Seek 80%' onPress={() => this.seekToPercent(0.8)} />
I also put added some logging to the native code to start debugging. It seems it is updating the info center with the incorrect values.
// AudioPlayer.swift
func updateNowPlayingInfoCenter() {
#if os(iOS) || os(tvOS)
if let item = currentItem {
MPNowPlayingInfoCenter.default().ap_update(
with: item,
duration: currentItemDuration,
progression: currentItemProgression,
playbackRate: player?.rate ?? 0)
print("updateNowPlayingInfoCenter");
print("------");
print("progression: " + currentItemProgression);
print("duration: " + currentItemDuration);
print("------");
} else {
MPNowPlayingInfoCenter.default().nowPlayingInfo = nil
}
#endif
}
------------------------------------
RESULTS in log messages like this:
------------------------------------
Seeking to 28.682448979591836 seconds
updateNowPlayingInfoCenter
progression: Optional(15.407348744)
duration: Optional(143.41224489795917)
------
Seeking to 86.0473469387755 seconds
updateNowPlayingInfoCenter
progression: Optional(34.793911304)
duration: Optional(143.41224489795917)
------
Seeking to 57.36489795918367 seconds
updateNowPlayingInfoCenter
progression: Optional(94.359329241)
duration: Optional(143.41224489795917)
------
Seeking to 57.36489795918367 seconds
updateNowPlayingInfoCenter
progression: Optional(58.017931807)
duration: Optional(143.41224489795917)
------
As you can see on the last case there, seeking quickly to the same time, ends up being much more accurate, but still not quite right.
I get the feeling the native code just needs to wait until after the seek has actually happened to update the info center, but I haven't had a chance to figure out the best way to accomplish that. Will dig deeper if I have time.
We are getting close to releasing our app, is there anything I can do about this?
Does 1.0.0 address this issue?
We are still on 0.2.5 because we aren't sure if 1.0.0 is stable enough yet.
I have a similar problem.
When i do a "seek" the lock screen progress bar on ios doesn't refresh.
To fix it, i do some useless action
Also finding this as a problem!
Track player v1.0.2
iOS 12.0.1
After calling TrackPlayer.seekTo, I find that the lock screen progress and value of TrackPlayer.getPosition are incorrect.
Would it make sense the the introduction of a revamped player for iOS in version 1.1.0 resolved this issue?
I am testing on 1.1.3 now and I am not seeing the issue anymore.
Please close this issue if this is the case.
Most helpful comment
We are getting close to releasing our app, is there anything I can do about this?
Does 1.0.0 address this issue?
We are still on 0.2.5 because we aren't sure if 1.0.0 is stable enough yet.