Skip to content

Commit

Permalink
new ver for voice player
Browse files Browse the repository at this point in the history
  • Loading branch information
em-ad committed Apr 21, 2022
1 parent a4c96e5 commit df3c142
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions chatkitlight/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 109
versionName "3.0.47.4.11"
versionCode 111
versionName "3.0.47.4.12"
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ public void setSingletonMediaPlayerCallback(SingletonMediaPlayerCallback singlet
*/
public synchronized void playSound(String fileName) {

if (instance.mediaPlayer == null) {
instance.mediaPlayer = new MediaPlayer();
} else {
instance.mediaPlayer.reset();
}
if(instance.mediaPlayer != null)
instance.mediaPlayer.stop();
stopSound();
instance.mediaPlayer = new MediaPlayer();
try {
instance.mediaPlayer.setDataSource(fileName);
instance.mediaPlayer.prepare();
Expand All @@ -58,10 +57,10 @@ public synchronized void playSound(String fileName) {
instance.mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
@Override
public void onBufferingUpdate(MediaPlayer mediaPlayer, int i) {
Log.i(TAG, "onBufferingUpdate: " + i);
Log.e(TAG, "onBufferingUpdate: " + i);
}
});
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
Expand Down

0 comments on commit df3c142

Please sign in to comment.