AudioPlayerView icon indicating copy to clipboard operation
AudioPlayerView copied to clipboard

Play twice

Open diegolucasb opened this issue 8 years ago • 9 comments

When you click stop while audio is playing, it starts to play again!

diegolucasb avatar Jan 25 '17 12:01 diegolucasb

Hi Diego,

are you sure you don't click twice on the button?

More info will be appreciated

HugoMatilla avatar Jan 25 '17 14:01 HugoMatilla

Hi Hugo,

Yes, I'm sure! You can check that in your sample app. Click play (any view) and before audio finishes, click again, it should stop and change icon to play. Instead of it, it is playing again.

diegolucasb avatar Jan 25 '17 17:01 diegolucasb

Looks like it plays again a couple of seconds and then stops. With short sounds it might play the whole audio twice. I will give it a check when I have some time. If you need it to be fixed asap I recommend you to check the code, is just one class. And if you find the bug feel free to make a pull request.

https://github.com/HugoMatilla/AudioPlayerView/blob/master/audioplayerview/src/main/java/com/hugomatilla/audioplayerview/AudioPlayerView.java

HugoMatilla avatar Jan 25 '17 18:01 HugoMatilla

Sure! I'm checking it and I'm making some improvements (adding a seekbar). As soon as I get it done, I'll let you know! If you think it is ok, I'll make a pull request. Thanks!

diegolucasb avatar Jan 25 '17 18:01 diegolucasb

Hugo,

I have forked your repo and made some changes. Please take a look: https://github.com/diegolucasb/AudioPlayerView

If you find it interesting we can make a pull request!

By the way, the problema I said before (play twice) happened when you call mediaPlayer.seekTo(0) after call mediaPlayer.pause(); If you call pause after seekTo(0) works fine! Have no idea why!!

diegolucasb avatar Jan 25 '17 20:01 diegolucasb

Awesome work @diegolucasb 🥇

I will try to update the fix for the "play twice" soon.

I checked your fork and there are a couple things that I would suggest.

1.- There is a long time since I don't work with seekbars. It seems good 👍 .

2.- Changing Stop to Pause makes the widget have a different behaviour as I planned. It is suppose to be used with small audios so pausing the audio has no sense. In any case if we want to add this feature it should be parameterised. So the user of the lib could choose of he want to have a pause or a stop.

3.- Why did you change the main icons? :)

HugoMatilla avatar Jan 25 '17 21:01 HugoMatilla

Thanks @HugoMatilla. Glad you like it!

1.- ok

2.- I'm using it with small audios as well, 10 sec average. I think pausing small audios has no sense if you don't have seekbar, loot at WhatsApp audio player, for example. That was my intention when I added a seekbar and changed stop feature to pause. I strongly agree with you though. I has to be parameterized, I gonna add this feature ASAP.

3.- I though them prettier. Sorry! hahah Well, I can put it back if you think it is important for the lib consistency!

Thanks again!

diegolucasb avatar Jan 26 '17 00:01 diegolucasb

You are very welcome :)

2.-I think you can just change the stop to pause if there is a seekbar, so not need for an extra paramaeter. If there is a seekbar linked to the AudioPlayerView, the stop function changes to pause function. What do you think?

3.-Yes please. I think the original ones are less styled so they fit better in any UI.

Keep it rolling 👍

HugoMatilla avatar Jan 26 '17 09:01 HugoMatilla

@HugoMatilla

2.- Sounds good! I'm gonna do it

3.- Ok, no problem! Gonna put it back!

Thanks!

diegolucasb avatar Jan 26 '17 11:01 diegolucasb