N noeleon Active Member Licensed User Longtime User Dec 9, 2019 #1 I tried the sample project attest.zip for AudioTrack and I can't figure out how to pause/resume playing. Calling at.pause immediately triggers the Play_Ended event. And if I comment out at.Release and call at.play it will only play for a few milliseconds which I'm guessing is the data left in the buffer, then nothing else. Code: Copy Sub activity_Click ToastMessageShow("pause", False) at.Pause End Sub Sub activity_LongClick ToastMessageShow("resume", False) at.Play End Sub
I tried the sample project attest.zip for AudioTrack and I can't figure out how to pause/resume playing. Calling at.pause immediately triggers the Play_Ended event. And if I comment out at.Release and call at.play it will only play for a few milliseconds which I'm guessing is the data left in the buffer, then nothing else. Code: Copy Sub activity_Click ToastMessageShow("pause", False) at.Pause End Sub Sub activity_LongClick ToastMessageShow("resume", False) at.Play End Sub
Erel B4X founder Staff member Licensed User Longtime User Dec 9, 2019 #2 I'm not familiar with AudioTrack library, however it is probably quite similar to AudioStreamer from Audio library. You should usually have a timer that feeds the buffer. You can then disable and enable the timer as needed. Upvote 0
I'm not familiar with AudioTrack library, however it is probably quite similar to AudioStreamer from Audio library. You should usually have a timer that feeds the buffer. You can then disable and enable the timer as needed.
stevel05 Expert Licensed User Longtime User Dec 9, 2019 #3 This was one of my first libraries and a lot has changed in the Andriod class since this was written, however the Audiotrack,Pause method pauses the Audiotrack object not the data that is fed to it which is done in the code. This needs to be implemented in the code either with a flag, or as Erel suggests using a timer with either option remembering the current data position and resuming when needed. Upvote 0
This was one of my first libraries and a lot has changed in the Andriod class since this was written, however the Audiotrack,Pause method pauses the Audiotrack object not the data that is fed to it which is done in the code. This needs to be implemented in the code either with a flag, or as Erel suggests using a timer with either option remembering the current data position and resuming when needed.
N noeleon Active Member Licensed User Longtime User Dec 10, 2019 #4 Thank you. I'll try those suggestions. Upvote 0