Skip to content

Commit bbb48bc

Browse files
guangyaoguangyao
authored andcommitted
2 parents 087d88d + 0429d71 commit bbb48bc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NIM.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export default class NIM{
158158
if(Platform.OS === 'ios'){
159159
return RNNeteaseIm.playLocal(name,type);
160160
}
161-
return RNNeteaseIm.playLocal("assets:///"+name,type);
161+
return RNNeteaseIm.playLocal('assets:///'+name+'.'+type,type);
162162
}
163163
/**
164164
* 停止播放录音

android/src/main/java/com/netease/im/RNNeteaseImModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,9 @@ public void playLocal(String resourceFile, String type, Promise promise) {
16601660
String filePath = uri.getPath();
16611661
if(filePath.startsWith("/")){
16621662
filePath = filePath.substring(1);
1663+
if (filePath.indexOf(".") == -1) {
1664+
filePath = filePath + "." + type;
1665+
}
16631666
}
16641667
LogUtil.i(TAG, "path:" + filePath);
16651668
audioPlayService.playAudio(handler, reactContext, AudioManager.STREAM_RING, uri.getScheme(), filePath);

0 commit comments

Comments
 (0)