- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I was wondering if there is any way to manually control media resources, such as clearing previous media buffers or controlling how much ram they use? I have a media rich app that runs fine initially but gradually starts to stutter and die on some android tablets, presumably because of a lack of efficient or fast enough garbage collection. I am trying to use a restricted number of audio (html) tags but the problem is still there.
thanks,
T
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
See this example: https://github.com/xmnboy/hello-cordova
There is function call media.release which marks the resources for garbage collection.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Amrita - thank you, that's exactly what I was looking for. I know this puts me well and truly in the 'should have read the literature first' category, sorry about that! In my (weak) defence I'm trying to convert an Appcelerator Titanium app and actually went through and deleted all references to 'release()'! Oh well...
My only problem now is that I can't include the cordova.js file - in the literature it says it's a 'phantom' file that doesn't exist until you build the app, but it isn't including it when I do build the app so I'm sure I'm missing something, this is pretty basic after all!
Thanks,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
Cordova.js should be in there when you extract your apk file after build. I just tried on a few samples and they all contain the file. Did you try your app on device? Is it working as it should?
Try the res/raw folder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes sorry - running the debug with my device, cordova.js must be there as it isn't throwing any errors - however from what I've read, the release() function only works with the native media plugin, which can only play one sound at a time, is that correct?
At the moment I'm using html audio tags to play multi-channel sound. Basically I have 6 audio tags that I reuse throughout the game, changing src. It's a mixture of 3-5 minute background music loops, 60-sec ambient loops and short 5-10 speech clips that play simultaneously. I was hoping that by using just those 6 and changing the source it'd conserve memory, but I'm not sure it really works like that? It works pretty well otherwise. There's no need for instant (sound effect) playback, I would use the Web Audio API for that if I needed it, but obviously it's no use for these long clips I'm playing.
Thanks for you help!
T
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is your app working now?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm still using HTML audio tags rather than Cordova native media but actually the app seems to be working much better now, probably mainly because I've spent some time redesigning the UI and have removed the need for some large graphic divs and other memory-eating resources, so it's likely these were actually more of a problem than the audio.
If it ain't broke don't fix it I guess!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The only disadvantages ia that HTML5 <audio> tag does not work well in the webviews on many devices. Bu if it works for you well and good :)
Have you tried a low latency media plugin? http://www.tricedesigns.com/2012/01/25/low-latency-polyphonic-audio-in-phonegap/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry Anusha, just saw your reply - no I haven't tried that plugin yet simply because it's working fine just using HTML audio at the moment, I'm using Crosswalk anyway so there shouldn't be any web view problems.
However I've now run in to another disaster I'm going to ask about on a separate thread - Google Expansion Packs!!
T
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page