Skip to content

Commit d54c39c

Browse files
committed
播放音频getCurrentPosition Exception
1 parent 2f8908e commit d54c39c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

android/src/main/java/com/netease/im/session/AudioPlayService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ public boolean updateAudioStreamType(int audioStreamType) {
160160

161161
private void changeAudioStreamType(int audioStreamType) {
162162
if (isPlayingAudio()) {
163-
seekPosition = currentAudioPlayer.getCurrentPosition();
163+
try {
164+
seekPosition = currentAudioPlayer.getCurrentPosition();
165+
} catch (Exception e) {
166+
e.printStackTrace();
167+
}
164168
needSeek = true;
165169
currentAudioStreamType = audioStreamType;
166170
currentAudioPlayer.start(audioStreamType);

android/src/main/java/com/netease/im/session/AudioPlayerM.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ public void handleMessage(Message var1) {
5757
switch (var1.what) {
5858
case 0:
5959
if (AudioPlayerM.this.mListener != null) {
60-
AudioPlayerM.this.mListener.onPlaying((long) AudioPlayerM.this.mPlayer.getCurrentPosition());
60+
try {
61+
AudioPlayerM.this.mListener.onPlaying((long) AudioPlayerM.this.mPlayer.getCurrentPosition());//TODO
62+
} catch (Exception e) {
63+
e.printStackTrace();
64+
}
6165
}
6266

6367
this.sendEmptyMessageDelayed(0, AudioPlayerM.this.mIntervalTime);

0 commit comments

Comments
 (0)