Solvedreact native track player v2 [@next, rc-18 published]

dcvz
294

v2.0.0

Changes

  • RN 0.60 minimum requirement
  • Update example to use RN 0.60 (rc-14)
  • Refactored API to export constants separately from default export via #654
  • Split of metadata update methods - #634
  • Queue methods to work based on index and not id - #688 (rc-14)
  • API for setting a repeat mode #1178 (rc-15)
  • API for shuffling play of queue (deferred)
  • API for moving an item at an index to another index (deferred)
  • Add support for separate jump intervals #1177 (rc-15)
  • Fix progress hook
  • Added playback-metadata-received event to be notified of metadata changes on streams #1175 (rc-15)
  • Add a new playback-about-to-end event to provide a chance for loading next track data. - (See #818 (comment))
  • Make sure documentation is up to date

To update run yarn add react-native-track-player@next. Breaking changes are outlined below:

Migrating to RN 0.60

We've migrated to AndroidX, please follow migration instructions provided by the ReactNative team.

Exports Updated

PR: #654 has changed the default export to only include methods on the player. State, Capability, PitchAlgorithm, TrackType and Event are now exported as enums.

import TrackPlayer, { State, Capability, TrackType } from '...'

Progress Hook Renamed

The hook useTrackPlayerProgress() has been fixed and renamed: useProgress(). The return has also been modified: bufferedPosition is now buffered.

@returns { position, duration, ~buffered~ }
53 Answers

✔️Accepted Answer

The last publish to npm was done 6 months ago, has there been any progress since then and if so can it please be put into a new RC?

Yes, we'll eventually publish a new version, there are quite a few bug fixes and new features that we've been working on in the last few weeks (you can see the progress in the v2 branch).

There's no up-to-date v2.0.0 documentation available anywhere (please do direct me to it if I'm wrong), could we get something more than the odd comment and/or bullet point in random, scattered issues? It would make sense to me to actively keep the documentation up-to-date in the v2 branch (if that's even what's being used)

There is in the docs folder in the v2 branch. It's not fully updated yet, but most of the new features are already there.

Again, I do appreciate this package, it's a great piece of work and I'd love to keep using it, however, it seems it's been abandoned or neglected, so could we please get an update?

We've been discussing a bit of that on #703

Other Answers:

@dcvz After playing around with rc13 some more it seems there are some fundamental issues with getPosition and getDuration on iOS. I'll try and put together a small repro so you can examine what's going on but essentially two huge problems are:

  1. getDuration is not consistent. After setting up the TrackPlayer and calling await TrackPlayer.add(tracks) calling await TrackPlayer.getDuration() after might return 0 or might return the true duration. All we know is that it's wrong when its 0 so the hack right now is to setup an interval and wait until it starts returning a non-zero value. So for this API and for the useProgress hook to work properly we need fix whatever race condition exists here and always return a non-zero duration after we've added tracks. Maybe there is another function we need to await for but there exists some obvious race condition here.

  2. getPosition also is not consistent. After setting up the TrackPlayer and calling await TrackPlayer.add(tracks) and await TrackPlayer.seekTo(newPosition) calling await TrackPlayer.getPosition() may return 0 or may return newPosition. Again there has to be some race condition getting in the way here. I've checked that I'm only calling seekTo in one spot and awaiting that to finish. This one usually never returns the newPosition until the podcasts has started playing even if we do the hack I wrote about here to run TrackPlayer.play(); await TrackPlayer.seekTo(newPosition); TrackPlayer.pause()

Really not sure what's going on here. In the meantime I need to revert back to the v1.x.x for my own app, but after I get that back to working I'll try to put together a small repro to illustrate these bugs.

If you're absolutely not noticing these race conditions then I think the project that we're testing the library in must be getting around the race conditions however I can guarantee they exist in this project and we're going to need to solve them to move forward with the v2

Thanks everyone for the reports! Officially v2 is now out!

We've also gone through and mass cleaned the issues log in an effort to give us a better chance of maintaining this library and fixing new issues. If there's any issues with v2 please report them :)

We'll focus on stabilising any new issues + queue manipulations like shuffle and reordering.

Not to muddy the waters and seem ungrateful for all the wonderful work being done, but can we please get an update on how the release is going and what is and isn't being worked on if anything? I've spent the last week trying to get RC13 up and running to no avail, because the useProgress() hook is broken and returns 0 as @CaptainRedBeard described, along with a handful of other issues.

  • The last publish to npm was done 6 months ago, has there been any progress since then and if so can it please be put into a new RC?

  • There's no up-to-date v2.0.0 documentation available anywhere (please do direct me to it if I'm wrong), could we get something more than the odd comment and/or bullet point in random, scattered issues? It would make sense to me to actively keep the documentation up-to-date in the v2 branch (if that's even what's being used)

Again, I do appreciate this package, it's a great piece of work and I'd love to keep using it, however, it seems it's been abandoned or neglected, so could we please get an update?

Also, sorry if this isn't the perfect spot to post this or if there's an answer to my questions in some other random issue, I just couldn't find anything else.

@dcvz Thanks to you for this amazing library!

Related Issues:

19
react native track player [iOS] The Swift pod react-native-track-player depends upon React, which do not define modules.
@waqas19921 thanks! Just to make it clear: node_modules/react-native-track-player/react-native-track...
17
react native track player _reactNativeTrackPlayer.usePlaybackState is undefined
I couldn't get useTrackPlayerEvents to work it was saying undefined is not a function The solution I...
12
react native track player v2 [@next, rc-18 published]
The last publish to npm was done 6 months ago has there been any progress since then and if so can i...
11
react native track player App crash on iOS, even on mode debug
Hi Disclaimer: I have touched Swift code from time to time but I'm not an expert so please correct m...
750
react native keychain SDK Build Tools revision (23.0.1) is too low for project :react-native-keychain.
Ok I found a solution to this For people facing the same problem in the future Hey there ...
748
material components android Manifest merger failed : Attribute application@appComponentFactory
I had similar problem We're transitioning from github issues to a public buganizer component Rather ...
746
expo Error: fsevents unavailable (this watcher can only be used on Darwin)
Possible solution: I had installed watchman via npm install -g watchman but apparently this installs...
459
flutter Multiple commands produce '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework
I was able to fix it by opening the Runner workspace project in Xcode 10 Then navigate to File ...
449
flutter App Store iOS submission fails: The bundle Runner.app/Frameworks/App.framework does not support the minimum OS Version specified in the Info.plist
After doing a flutter clean changing MinimumOSVersion (inside /ios/Flutter/AppframeworkInfo.plist) t...
418
flutter 'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
is like this i receive an error when i run flutter run My gradle.build file is: flutter doctor: ...
409
flutter Why does my text not wrap?
You have to wrap Column in a flexible Without flexible the column's width is not constrained to the ...
383
flutter Unexpected top padding in ListView put inside scaffold with no appBar
Yeah this is intentional If you put a widget before the ListView you should wrap the ListView with a...
315
flutter Missing xcode dependency: Python module "six"
try python2.x -m pip install six by @humblerookie's suggest or brew reinstall python@2 pip install s...
306
expo exp build:android fails
This works exp start Cancel ctrl c then do exp build:android. Running exp build:android errors fails...
285
flutter flutter messaging: set the notification icon
Hey guys I fought with this for the better part of a day For some strange reason there are no tutori...
281
flutter Issue with cloud_firestore - Cannot fit requested classes in a single dex file.
As a workaround you can try enabling mutlidex for Android App by following Enable multidex for apps ...
265
flutter D8: Program type already present: io.flutter.BuildConfig
@smrucv I received the same error but after flutter clean and flutter packages get everything works ...
250
238
flutter Introduction of characters package causes crash on flutter run for preexisting Flutter applications
In my case I resolved the issue with flutter clean After e0ed12c I get this error when building: @ju...
222
nativescript cli TNS doctor doesn't recognize Xcode (High Sierra)
HI @philipfeldmann Can yhou please run xcodebuild -version and paste the output? May be Xcode is ins...
221
flutter Making Network http error SocketException: Failed host lookup
@hoc081098 Double-check / make sure you have <uses-permission android:name=android.permission.INTERN...
216
flutter Support inlining Android/iOS views
iOS view embedding support has landed on master This is still just a preview There are multiple open...
207
flutter ✗ Android license status unknown.
Hi everyone Steps to Reproduce Please tell us what you were doing and what went wrong If you are run...
195
react native mapbox gl No static method toHumanReadableAscii
here is workaround: build.gradle got the following error on runtime: java.lang.NoSuchMethodError: No...
185
flutter idevice_id cannot run on catalina
When you're developing on Catalina Steps to Reproduce Run flutter doctor on macOS Catalina I get the...
181
flutter type 'List<dynamic>' is not a subtype of type 'List<String>'
The problem is your fromMap constructor is reading from a Map<String dynamic> ...
178
flutter TextField is hidden by keyboard inside of a Modal Bottom Sheet
This may not work for all situations but I have a modalBottomSheet that contains only a TextField ...
173
retrofit Kotlin & @Body
You can still use Map just suppress its wildcardness with @JvmSuppressWildcards ...
169
NativeBase Needs to tap twice to fire onPress function when keyboard is open
@bm-software Use keyboardShouldPersistTaps={'handled'} and will works fine. react-native ...
162
react native firebase 🔥(Android) Program type already present: io.invertase.firebase.BuildConfig
I think I found my ultimate error here In my package.json file I had at some point earlier ...
160
flutter Dismissing keyboard programatically
This is a better way as it also clears the focus: FocusScope.of(context).requestFocus(new FocusNode(...
157
flutter How to solve: Android license status unknown and also Android sdkmanager tool not found? Tried everything(as i think)
The answer is here Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1...
156
flutter MissingPluginException: No implementation found for method
@mravn-google Yeah turned out I had to quit the flutter run process and start it up again Just a ful...
156
flutter firebase_auth: ^0.8.0+1 crashes on Android
Here i put this in file: android/gradle.properties: and changed targetSdkVersion to 28 and it worked...
156
react native modal The statusbar turns white when the modal is open (only on certain devices)
statusBarTranslucent property has been added to Modal of RN 0.62 I think this problem has been solve...
153
flutter Android sdkmanager tool not found (C:...\Local\Android\sdk\tools\bin\sdkmanager)
This worked for me: open Android Studio's SDK Manager go to the Android SDK tab under SDK Tools ...
149
flutter 1.22.2 - Flutter plugin not installed; this adds Flutter specific functionality.
Hey @bhanuka96 try this line of code How do I fix this android plugin error? This error is being com...
145
cli pod install failure with glog
what helped me: sudo xcode-select --switch /Applications/Xcode.app Ask your Question I have been try...
144
create react native app issue running on ubuntu 16.04 (watchman)
I got it working by running: OS Info: Run: Output: ...
139
flutter [ios][release] GeneratedPluginRegistrant.m Module not found
I may have found the answer from this comment: #21989 (comment) Seems like by opening up the project...
137
flutter [App.framework] Linked and embedded framework 'App.framework' was built for iOS/iOS Simulator
Does rm -rf ios/Flutter/App.framework get you unstuck? SOLUTION @jmagman has written an article on h...
137
Xposed Let's port Xposed to N
Surprisingly by porting M changes to N everything works well From my experience I can tell you that ...
134
flutter Bad state: Future already completed
I had the same issue.. The problem was the same that @soaresgabriel said but I was not navigating di...
131
create react native app AwesomeProject@0.1.0 start: react-native-scripts start- ERR! Exit status 1
As suggested at the error message installing watchman solved this error for me (OSX 10.9.5) ...
129
flutter Execution failed for task ':app:compileFlutterBuildDebug' Issue
Hi @Ramihtet your logs show a different flutter version; could you please run flutter channel stable...
126
capacitor FileReader API not firing
You can try this. Description of the problem: In my project I'm trying to read and convert a Blob do...
124
flutter Unable to load Asset - wrong indentation in pubspec.yaml
Is your assets key underneath a flutter: key as well? https://flutter.io/assets-and-images/ ...