callback/callback-android — Issue #55: loop in media
Author: superyarik
Created: 2011-12-15 14:15:26+00:00
State: open

Sometimes needs to loop playing of audioo file. There is old page on wiki:
http://wiki.phonegap.com/w/page/16494826/Sounds

there is example

```javascript
new Media('audio/mySong.wav').play({numberOfLoops:99});
```
As i see it's old implemetnanion and now it's not work. I found this way with using mediaStatus:

```javascript
MyAudio = new Media('/android_asset/www/mp3/file.mp3', null, null, function(status) {
if(status==4){
MyAudio.play();
}
});
```

But if we call .pause() and after .play() we have log message like this:

> AudioPlayer Error: startPlaying() called during invalid state: 2

it's appear because mediaStatus is calling by .play(), when audio started play.
So, we have two situations with one code:
1. audio ends
2. we start audio

i see two ways: new code of mediaStatus or special implement of loop like in link above.