-
Notifications
You must be signed in to change notification settings - Fork 751
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
v1.0.0 Typescript #721
Comments
@RomualdPercereau IMO we should move to a smart mechanism which control a bit more what's happening and offer more features. For the current stage I think wrapping tracks into a private Track class and exposing Sound class would be useful. Sound will provide a set of methods to manages Tracks using an internal Map of Track instances. Those methods can be:
Then the private And then later, once stable and well tested, it will be simpler to add some other features. PS: can you pin this issue please? |
Hello @antoine-pous I don't know exactly how people are using react-native-sound. But not exposing the Track class and move to a string based api is a quite big change. (Other other opinions are welcome!) It wouldn't be possible anymore to use it like this: sound.js
anywhere
|
This version is a breaking change, so in fact it will be hard to use it the old way 😅 The main goal is to avoid this kind of import and having a simplified way to use it in any place of your app. You can still expose the Track class to use it from the old way, but the developer will lose the wrapper advantage and will have to do all the controls by himself. And Sound should be renamed Player, I think it's a best name for the wrapper. |
Sure! I'm just not so sure that the new usage of Track is really a simplification since its require to manage a list of sounds & strings instead of only sounds object 🙂
|
I guess it's called Sound because the lib is called react-native-sound. The usage is to call the import something similar to the name of the lib, for example: react-native-track-player -> TrackPlayer Wouldn't be quite confusing to ?
|
I understand, it can be confusing yeah. Then Track can remain Sound and Player an optional and enhanced way to manage a library. |
Looks great! Would you have time to do a PR? |
Yup, in few days |
Hello @antoine-pous, |
Not yet unfortunately :( |
had to give up on this library - maybe this PR would resolve. but for now users won't be getting sound fx. |
any updates |
This is a work in progress, this issue is related to PR #713 and still need some fixes and requires a lot of tests. Any advice are welcome, the debate will continue here to give a better view about the changes which are applied to v1.0.0 branch.
What's new:
rejectOnUnsupportedFeature {Boolean}
which ensure that using an unsupported feature will be rejected. If disabled (default behavior) the function will be resolvedenable
/disable
setSpeakerphoneOn
/setSpeakerphoneOff
enableInSilenceMode
/disableInSilenceMode
setActive
/setInactive
SoundBasePath
type which can be'MAIN_BUNDLE' | 'DOCUMENT' | 'LIBRARY' | 'CACHES' | string
SoundOptions
interface withrejectOnUnsupportedFeature?: boolean
andenableSMTCIntegration?: boolean
RNSoundModule.createMediaPlayer
will execute the callback error with more explicit messages.Resource not found
covered too much errors, this update will give a better view of what's happening exactly.Resource not found
remain as last error when the function is not able to determine which action is requested, maybe should we put a better error message. Error payload have also a new key namedresource
which provide the full path of the fetched file to enhance debugging.Known issues
IsAndroid
istrue
predefined directories areundefined
using React Native with ExpoRemaining changes:
This is clearly a braking change and i don't see any reason to continue to support legacy stuff when most of supported versions of RN, by this lib, are not supported anymore. If people are not able to upgrade their dependencies and follow the new standards it's sad but IMO a library must remain updated, they can still use legacy versions of the library if needed.
Feel free to suggest any changes
To test it in your projects:
Using Yarn:
yarn add zmxv/react-native-sound#1.0.0
Using NPM:
npm install git://github.com/zmxv/react-native-sound.git#1.0.0 --save
Usage example
The text was updated successfully, but these errors were encountered: