Fixed crash if media file exists but can not be read
Happens when exporting db and importing it into debug version because media files are located in an app-private folder
This commit is contained in:
parent
c79b003dff
commit
4213d8fc8b
|
@ -11,6 +11,7 @@ import android.view.SurfaceHolder;
|
|||
|
||||
import org.antennapod.audio.MediaPlayer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Future;
|
||||
|
@ -165,8 +166,10 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
|
|||
callback.onMediaChanged(false);
|
||||
if (stream) {
|
||||
mediaPlayer.setDataSource(media.getStreamUrl());
|
||||
} else {
|
||||
} else if (new File(media.getLocalMediaUrl()).canRead()) {
|
||||
mediaPlayer.setDataSource(media.getLocalMediaUrl());
|
||||
} else {
|
||||
throw new IOException("Unable to read local file " + media.getLocalMediaUrl());
|
||||
}
|
||||
setPlayerStatus(PlayerStatus.INITIALIZED, media);
|
||||
|
||||
|
|
Loading…
Reference in New Issue