Skip to content
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

updateOptions overwrites previously set forwardJumpInterval #1853

Closed
fivecar opened this issue Dec 17, 2022 · 0 comments · Fixed by #1855
Closed

updateOptions overwrites previously set forwardJumpInterval #1853

fivecar opened this issue Dec 17, 2022 · 0 comments · Fixed by #1855
Labels

Comments

@fivecar
Copy link
Contributor

fivecar commented Dec 17, 2022

Describe the Bug
Although the docs say that updateOptions won't overwrite values that you omit, it actually does. You can see this in how RNTrackPlayer.swift calls Capabilities.swift. Basically, if you want to update capabilities and retain the ability to jump forward, you can't do so without also re-specifying forwardJumpInterval (because the code otherwise overwrites your previous interval with 15).

Steps To Reproduce
The following sequence is the simplest repro:

player.updateOptions({
  capabilities: [
    Capabilities.Play,
    Capability.Pause,
    Capability.SeekTo,
    Capability.JumpForward,
  ],
  forwardJumpInterval: 60,
});
...
player.updateOptions({
  capabilities: [
    Capabilities.Play,
    Capability.Pause,
    Capability.SeekTo,
    Capability.JumpForward,
  ],
});  

After this sequence, the forwardJumpInterval becomes 15, even though the docs claim that you only need to set the MetadataOptions that you wish to change.

Code To Reproduce
Fully running example app showing this bug at https://github.com/SuperphonicHub/react-native-track-player/tree/update_options_broken

Replicable on Example App?
Yes. Run the code in the branch above.

Environment Info:
System:
OS: macOS 13.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 2.88 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 2.4.3 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /Users/philipsu/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7784292
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 17.0.4.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.3 => 0.69.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

react-native-track-player: "^3.2.0"

Real device? Or simulator? Both
What OS are you running? iOS 12.4

How I can Help
What can you do to help resolve this?
I don't know Swift, but I can attempt a fix and send it along

Have you investigated the underlying JS or Swift/Android code causing this bug?
Yes. It's pretty clear where the error is.

Can you create a Pull Request with a fix?
I might be able to, but will need help with Swiftage.

@fivecar fivecar added the Bug label Dec 17, 2022
fivecar added a commit to SuperphonicHub/react-native-track-player that referenced this issue Dec 17, 2022
fivecar added a commit to SuperphonicHub/react-native-track-player that referenced this issue Dec 18, 2022
…ips when user omits them

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This  fix prevents that problem.

fix doublesymmetry#1853
fivecar added a commit to SuperphonicHub/react-native-track-player that referenced this issue Dec 18, 2022
…ips when user omits them

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This  fix prevents that problem.

fix doublesymmetry#1853
fivecar added a commit to SuperphonicHub/react-native-track-player that referenced this issue Dec 18, 2022
…ips when user omits them

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This  fix prevents that problem.

fix doublesymmetry#1853
fivecar added a commit to SuperphonicHub/react-native-track-player that referenced this issue Jan 4, 2023
…ips when user omits them

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This  fix prevents that problem.

fix doublesymmetry#1853
fivecar added a commit to SuperphonicHub/react-native-track-player that referenced this issue Jan 31, 2023
…ips when user omits them

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This fix prevents that problem.

fix doublesymmetry#1853
@dcvz dcvz closed this as completed in #1855 Feb 1, 2023
dcvz pushed a commit that referenced this issue Feb 1, 2023
The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This fix prevents that problem.

fix #1853
shawna-donnelly pushed a commit to heistdotcom/react-native-track-player that referenced this issue Apr 4, 2023
…ry#1855)

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This fix prevents that problem.

fix doublesymmetry#1853
shawna-donnelly pushed a commit to heistdotcom/react-native-track-player that referenced this issue Apr 4, 2023
…ry#1855)

The previous code overwrote forward/backward skip seconds when you subsequently called updateOptions
without re-specifying the same times. This fix prevents that problem.

fix doublesymmetry#1853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant