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) {
63
63
@ Override
64
64
public void onProgressChanged (SeekBar seekBar , int progress , boolean fromUser ) {
65
65
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 ) );
69
69
}
70
70
}
71
71
72
72
@ Override
73
73
public void onStartTrackingTouch (SeekBar seekBar ) {
74
+ if (mediaPlayer != null && mediaPlayer .isPlaying ()) {
75
+ mediaPlayer .pause ();
76
+ }
74
77
}
75
78
76
79
@ Override
77
80
public void onStopTrackingTouch (SeekBar seekBar ) {
81
+ if (mediaPlayer != null ) {
82
+ mediaPlayer .start ();
83
+ }
78
84
}
79
85
});
86
+
80
87
}
81
88
82
89
public void setDataSource (String path ) throws IOException {
You can’t perform that action at this time.
0 commit comments