-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: add duration, currentTime, file url, oncomplete #10
Conversation
bugfix: rename podspec
README.md
Outdated
@@ -112,18 +115,20 @@ NativeAudio.preloadSimple({ | |||
/** | |||
* Platform: Android/iOS | |||
* This method will load more optimized audio files for background into memory. | |||
* @param assetPath - relative path of the file or absolute url (http://) | |||
* @param assetPath - relative path of the file or absolute url (file://) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I was in the impression that I could use this plugin with external resources too.
The preloadSimple comment still contains "http://" though.
Maybe even add a remark to the readme that this plugin only works with local files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I can do that.
actually I'm pretty sure that before this PR, you could only load assets from the app bundle / resources, as I tried to use file
URLs and failed, and thus added the isUrl
parameter to get them to work (but only for preloadComplex
).
My use case is downloading audio files to the app cache directory and playing them from there, hence I added support for file
URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added that second commit, let me know what else I can do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 Now we wait for someone to approve this PR 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good!
I added a documentation change to this PR to clarify, per #9, that on Android, your asset file must be in |
@Boosten @priyankpat Any update on this? |
@priyankpat has to approve and merge the PR :-) |
This is really cool can we merge these changes @priyankpat |
Please merge |
Please merge, I pulled his repo locally and it worked perfectly for me. This is a must needed feature and there aren't many other options. |
Also leaving a tactical dot for a merge request: . |
@priyankpat if you add me as a maintainer I'll get this merged. |
@kheftel, are you on the Capacitor Slack? If you are, DM me on there (@thomasv) and I can get you set up as a maintainer for this repo if you are interested 😄 |
@thomasvidas, I'm not, but am joining now. |
All these changes add in new version! |
Added some new features, fixed some bugs. Rebased it on your most recent 0.1.3 release. Hope it's not too much for one PR. Implemented and tested on iOS and Android.
Added the ability to get the duration of a loaded audio file. Restricted it to only
preloadComplex
sounds with 1 channel for simplicity.Added the ability to get the current time of a playing audio file for progress listeners / updates. Restricted it to only
preloadComplex
sounds with 1 channel for simplicity.Added a complete event at the end of a (complex) playing audio file.
Added the ability to ask if a particular audio is loaded (since the
unload
event now throws an error on android if a file is already loaded).