mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-13 14:41:03 +08:00
CB-446: Enhance setting data source for local files in AudioPlayer
This commit is contained in:
parent
aa00e07b3c
commit
ecebcbabf8
@ -28,6 +28,7 @@ import android.os.Environment;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,7 +219,8 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
else {
|
else {
|
||||||
File fp = new File(file);
|
File fp = new File(file);
|
||||||
if (fp.exists()) {
|
if (fp.exists()) {
|
||||||
this.mPlayer.setDataSource(file);
|
FileInputStream fileInputStream = new FileInputStream(file);
|
||||||
|
this.mPlayer.setDataSource(fileInputStream.getFD());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.mPlayer.setDataSource("/sdcard/" + file);
|
this.mPlayer.setDataSource("/sdcard/" + file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user