I am using Amazon Polly
, and I want to resume pronounced speech
where it was paused but it starts from beginning whenever i tried to resume. I set source in media player
as follows
mediaPlayer.setDataSource(presignedSynthesizeSpeechUrl.toString());
The code I tried to use pause and resume is as follows,
playPauseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(pauseVal){
mediaPlayer.seekTo(length);
mediaPlayer.start();
pauseVal = false;
}else{
mediaPlayer.pause();
length= mediaPlayer.getCurrentPosition();
pauseVal = true;
}
}
});
I am stuck here , can't move further with resume functionality. I will be thankful if any of you help.
Media player doesn't support resume functionality for passed URL . since I was using webview so I just passed that URL to Audio tag which supports resume functionality.