So I have a question.
When using Sound JS and the WebAudio plugin, whenever I createInstance
for the same audio file a second time, there's no second request being made. So createInstance
makes a http request for that sound file the first time it is being called, but then, whenever I call createInstance
again, with the same src, the audio file is taken from cache, and no useless requests are being made.
This is great. However, when using the Cordova plugin, it seems that createInstance
always makes a request for the audio file. It is never cached. I know this because each time the sound is being played, there's a certain delay before audio is heard. The same happens with WebAudio, but only on the initial play, after that, it plays instantly.
I believe this is because, in the Cordova plugin, when calling createInstance
, _playbackResource
is always created as new Media()
, as the documentation says here http://docs.phonegap.com/en/edge/cordova_media_media.md.html . So I guess there is no internal caching mechanism built in the Cordova Media plugin? So each time you call new Media(src)
, although the src was already loaded, Android makes a new request to the server each time.
Are these valid points? If so, then, what would be the solution? Should I keep a pool of all instances, when using the Cordova plugin?
Thanks.