Rolamix / cordova-plugin-playlist

🎶 A Cordova plugin for Android and iOS with native support for audio playlists, background support, and lock screen controls 🎶
MIT License
32 stars 32 forks source link

Amazing Script! #21

Open inglesuniversal opened 5 years ago

inglesuniversal commented 5 years ago

I'm looking forward to implement it on my project.

One question though, can I install the plugin on top of cordova-media just to provide the background audio capability or it would not work or rather you would suggest a different plugin for this purpose?

Can the script be run using vanilla JS or I would need to use it with Angular or TS (which I am not that familiar at this point)?

Regards

codinronan commented 5 years ago

Hey there @inglesuniversal actually I have this plugin running alongside cordova-plugin-media with no issue; for playing individual tracks I originally implemented it using cordova-plugin-media and didn't feel like ripping out that code, so I do run the two together!

The script can use vanilla JS - I just provided an example using Angular since many folks are using Ionic. All you really need to do is grab that window object and invoke its methods, just like the example service shows:

https://github.com/Rolamix/cordova-plugin-playlist/blob/master/examples/audio-service.ts#L91

The other code, the JS files in www/ are just vanilla JS that you can invoke on any platform, ES5 in fact so it should work on pretty much all reasonably recent browsers (last 6-7 years).