You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Gerwin Brunner <ge...@gmail.com> on 2015/06/01 10:16:08 UTC

Re: Media getCurrentPosition kills app after a while (cpu usage increases continously

Anybody got an idea why this happens?

Gerwin Brunner wrote:
> Hi,
>
> I'm experiencing a very strange behavior in the Media API.
> I just play a MP3 file and update the time spent playing.
>
> Here is a very simplistic code:
>
> var self;
> self = this;
> self.interval = 50;
> self.audioFile= "asd.wav";
>
> self.audio = new Media(self.audioFile, function() {
>   return console.log("Success");
> }, function(error) {
>   return console.log("Error " + error);
> });
>
> self.audio.play();
>
> self.getPos = function() {
>   return self.audio.getCurrentPosition(function(pos) {
>     //console.log("pos", pos);
>     return window.setTimeout(self.getPos, self.interval);
>   });
> };
>
> window.setTimeout(self.getPos, self.interval);
>
>
> The cpu usage continually increases during usage and after a while the 
> whole app freezes or gets totally unresponsive.
>
> I have no clue what causes this increase in CPU usage. Do you have a 
> clue what the reason for this could be?
>
>
>
> I also found this related question on StackOverflow
> http://stackoverflow.com/questions/27146849/media-plugin-getcurrentposition-repeated-call-stops-after-some-time 
>
>
> Cheers,
> Gerwin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org