Working SetChannelRate HTML5 Implementation!!

Monkey Targets Forums/HTML5/Working SetChannelRate HTML5 Implementation!!

mr_twister(Posted 2013) [#1]
Checking different sources I learnt that HTML5 DOES support setting the playrate of a given video/audio from JS code. So after some tinkering I got it working on Monkey.

You need to locate the following function in Mojos's native implementation for HML5 (mojo.html5.js):
gxtkAudio.prototype.SetRate=function( channel,rate ){
	var chan=this.channels[channel];
	chan.rate=rate;
}


And edit the "chan.rate="rate" line so the function looks like this:

gxtkAudio.prototype.SetRate=function( channel,rate ){
	var chan=this.channels[channel];
	if (chan.audio && chan.audio.playbackRate) chan.audio.playbackRate=rate;
}


The only "problem" I've found so far is that values below 0.5 don't seem to work. (at least for the sound file and browser I used for testing. Perhaps it works in the full range of values with other -higher quality- sound files or other browsers).


Xyle(Posted 2014) [#2]
Thats funny,

2nd day with MonkeyX and I needed this!

Thanks for figuring that out!


Yoda(Posted 2014) [#3]
I tried this and for me it doesn't work. Anything else I have to change or update to make it work?


skid(Posted 2014) [#4]
try putting this at top of your app

#HTML5_WEBAUDIO_ENABLED="1"