A plugin like Tone.js or ChordPlayer.js for Nativescript?


#1

Hi all, I’m having an enjoyable time developing apps with Nativescript, it is very cool indeed. Congrats to all involved! :slightly_smiling_face:

I’ve bumped into an issue though. I need a plugin like Tone.js or ChordPlayer.js in order to finish this app I’m building.

I have tried to use the plugins I have mentioned but they didn’t work cause they need the Web Audio Api which Nativescript doesn’t seem to support.

Any guidance towards the sorting out of this issue will be greatly appreciated.

Thanks!


#2

There is no such plugin as of now.

  1. You may try to find a similar native plugin from https://cocoapods.org/ or https://android-arsenal.com/ and wrap it as a {N} plugin.
  2. If you know how the JS library works, you may convert that into native with few layouts, css and audio player.

#3

Thank you very much for your quick response. If I have got it right, the only thing I need to convert this library to support nativescript is to change the audioContext, which I think refers to the audio player that is used with the library.

The audioContext that this library supports is window.AudioContext and window.webkitAudioContext, so all I need to do is to replace them for (android.audio.MediaPlayer) for Android and (AVAudioPlayer) for iOS.

Would you confirm my assumptions about that?

Once again, thank you for your time.


#4

Yes something like that and you will have to plan the UI too.