react-native-track-player: useProgress HLS bug on IOS

Describe the Bug A clear and concise description of what the bug is. Duration returned from useProgress while playing HLS live stream is not correct. All is well on android as I have observed.

Steps To Reproduce How can someone else reproduce this bug?

  • Add an HLS track to Trackplayer and play.
  • Monitor the useProgress output via console.

Code To Reproduce Please provide a simple code example that allows others to replicate the bug.

Trackplayer.add({
    ...track,
    type: "hls",
    isLiveStream: true,
    url: file.m3u8,
}).then(() => {
    Trackplayer.play();
});

const info = useProgress();
console.log(info); // normal if live stream is just starting, try joining at a much later time
Trackplayer.seekTo(secs); // triggers the issue
// ios
 LOG  {"buffered": 6700.753022675737, "duration": 17.972244897959182, "position": 6683.826420957}
 LOG  {"buffered": 6700.753022675737, "duration": 17.972244897959182, "position": 6683.826420957}
 LOG  {"buffered": 6700.753022675737, "duration": 17.972244897959182, "position": 6683.826420957}
 LOG  {"buffered": 6712.780959183673, "duration": 30.00018140589569, "position": 6674.442}
 LOG  {"buffered": 6712.780959183673, "duration": 30.00018140589569, "position": 6674.442}
 LOG  {"buffered": 6712.780959183673, "duration": 30.00018140589569, "position": 6674.442}
 LOG  {"buffered": 6712.780959183673, "duration": 30.00018140589569, "position": 6674.442}
 LOG  {"buffered": 6712.780959183673, "duration": 30.00018140589569, "position": 6674.442}
 LOG  {"buffered": 6671.623173922902, "duration": 0.8359183673469388, "position": 6670.85258876}
 LOG  {"buffered": 6671.623173922902, "duration": 0.8359183673469388, "position": 6670.85258876}
 LOG  {"buffered": 6688.782720408163, "duration": 17.99546485260771, "position": 6671.867501169}
 LOG  {"buffered": 6688.782720408163, "duration": 17.99546485260771, "position": 6671.867501169}
 LOG  {"buffered": 6694.773468707483, "duration": 23.986213151927437, "position": 6672.900312556}
 LOG  {"buffered": 6694.773468707483, "duration": 23.986213151927437, "position": 6672.900312556}
// android 
 LOG  {"buffered": 0, "duration": 0, "position": 0}
 LOG  {"buffered": 0, "duration": 0, "position": 0}
 LOG  {"buffered": 30.014, "duration": 42.004, "position": 24.004}
 LOG  {"buffered": 30.014, "duration": 42.004, "position": 24.004}
 LOG  {"buffered": 42.004, "duration": 42.004, "position": 24.004}
 LOG  {"buffered": 42.004, "duration": 42.004, "position": 24.004}
 LOG  {"buffered": 42.004, "duration": 42.004, "position": 24.004}
 LOG  {"buffered": 42.004, "duration": 42.004, "position": 24.004}
 LOG  {"buffered": 48.011, "duration": 48.011, "position": 26.436}
 LOG  {"buffered": 48.011, "duration": 48.011, "position": 26.436}
 LOG  {"buffered": 50.055, "duration": 54.008, "position": 29.905}
 LOG  {"buffered": 50.055, "duration": 54.008, "position": 29.905}
 LOG  {"buffered": 54.008, "duration": 54.008, "position": 33.554}
 LOG  {"buffered": 54.008, "duration": 54.008, "position": 33.554}
 LOG  {"buffered": 54.008, "duration": 54.008, "position": 33.677}
 LOG  {"buffered": 54.008, "duration": 54.008, "position": 33.677}

Environment Info: System: OS: macOS 12.3.1 CPU: (8) x64 Intel® Core™ i7-4870HQ CPU @ 2.50GHz Memory: 28.16 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 13.3/13E113 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.2 => 0.66.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

react-native-track-player@2.1.3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (14 by maintainers)

Most upvoted comments

The fix has been merged and will be released in the next RC

Ok sir, you’re the boss man. Pull request up https://github.com/doublesymmetry/SwiftAudioEx/pull/18.

No you’re good. Just an fyi

Correct, you fork the main repo crest a branch off of main implement your change there, then push it up to your fork. Then you creat a PR from your repo to the main repo. Probably some better walkthroughs than that on the internet too haha, but hopefully that makes sense

@jspizziri Hmmm, I’ll check the playlist then. Grateful for the pointers man. Let’s do some debugging “cracks knuckles”.

Makes a whole lot of sense man, thanks. See you at SwiftAudioEx!