File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
fileViewer/src/main/java/io/genemoz/fileviewer/audioView Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -63,20 +63,27 @@ private void init(Context context) {
6363 @ Override
6464 public void onProgressChanged (SeekBar seekBar , int progress , boolean fromUser ) {
6565 if (mediaPlayer != null && fromUser ) {
66- int duration = mediaPlayer .getDuration ( );
67- int seek = ( int ) (( float ) progress / 100.0 * ( float ) duration );
68- mediaPlayer .seekTo ( seek );
66+ mediaPlayer .seekTo ( progress );
67+ elapsedTimeLabel . setText ( formatTime ( progress ) );
68+ remainingTimeLabel . setText ( formatTime ( mediaPlayer .getDuration () - progress ) );
6969 }
7070 }
7171
7272 @ Override
7373 public void onStartTrackingTouch (SeekBar seekBar ) {
74+ if (mediaPlayer != null && mediaPlayer .isPlaying ()) {
75+ mediaPlayer .pause ();
76+ }
7477 }
7578
7679 @ Override
7780 public void onStopTrackingTouch (SeekBar seekBar ) {
81+ if (mediaPlayer != null ) {
82+ mediaPlayer .start ();
83+ }
7884 }
7985 });
86+
8087 }
8188
8289 public void setDataSource (String path ) throws IOException {
You can’t perform that action at this time.
0 commit comments