aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-08-21 18:40:02 -0700
committerScott Jackson <daneren2005@gmail.com>2014-08-21 18:40:02 -0700
commitf7dd85cc866e750cee334269f5fc41c02e8a0721 (patch)
tree3dd1dfc207bd45ea6ee960469cf42189f1980be2 /src/github
parent40f96d604812d3d2d1a0771933564d17e145a168 (diff)
downloaddsub-f7dd85cc866e750cee334269f5fc41c02e8a0721.tar.gz
dsub-f7dd85cc866e750cee334269f5fc41c02e8a0721.tar.bz2
dsub-f7dd85cc866e750cee334269f5fc41c02e8a0721.zip
Revert change to FD, try just using absolute path first
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 01d4aff0..5b4861ac 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -52,7 +52,6 @@ import github.daneren2005.dsub.util.compat.RemoteControlClientHelper;
import github.daneren2005.serverproxy.BufferProxy;
import java.io.File;
-import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -1361,29 +1360,20 @@ public class DownloadService extends Service {
} catch(Throwable e) {
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
}
+ String dataSource = file.getAbsolutePath();
if(isPartial) {
if (proxy == null) {
proxy = new BufferProxy(this);
proxy.start();
}
proxy.setBufferFile(downloadFile);
- String dataSource = proxy.getPrivateAddress(dataSource);
+ dataSource = proxy.getPrivateAddress(dataSource);
Log.i(TAG, "Data Source: " + dataSource);
- mediaPlayer.setDataSource(dataSource);
- } else {
- if(proxy != null) {
- proxy.stop();
- proxy = null;
- }
-
- RandomAccessFile accessFile;
- try {
- accessFile = new RandomAccessFile(file, "r");
- mediaPlayer.setDataSource(accessFile.getFD());
- } finally {
- Util.close(accessFile);
- }
+ } else if(proxy != null) {
+ proxy.stop();
+ proxy = null;
}
+ mediaPlayer.setDataSource(dataSource);
setPlayerState(PREPARING);
mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
@@ -1450,14 +1440,7 @@ public class DownloadService extends Service {
} catch(Throwable e) {
nextMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
}
-
- RandomAccessFile accessFile;
- try {
- accessFile = new RandomAccessFile(file, "r");
- nextMediaPlayer.setDataSource(accessFile.getFD());
- } finally {
- Util.close(accessFile);
- }
+ nextMediaPlayer.setDataSource(file.getPath());
setNextPlayerState(PREPARING);
nextMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {