aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-11 22:00:54 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-11 22:00:54 -0700
commit9f7aa3bc5cec9cb697d8cd064c26355d1a0f2038 (patch)
treeb0843bba4f7e16626acf7b5f58a1909b56e378e6 /subsonic-android/src/github/daneren2005
parent06f4da82e83a428b2a4440fef5f8ed110a09ebfb (diff)
downloaddsub-9f7aa3bc5cec9cb697d8cd064c26355d1a0f2038.tar.gz
dsub-9f7aa3bc5cec9cb697d8cd064c26355d1a0f2038.tar.bz2
dsub-9f7aa3bc5cec9cb697d8cd064c26355d1a0f2038.zip
Added HLS video streaming as option for video player
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java12
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java5
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/MusicService.java2
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java5
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java13
5 files changed, 35 insertions, 2 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index e8bac798..9b16fdcb 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -908,8 +908,12 @@ public class SubsonicFragment extends SherlockFragment {
String videoPlayerType = Util.getVideoPlayerType(context);
if("flash".equals(videoPlayerType)) {
playWebView(entry);
+ } else if("hls".equals(videoPlayerType)) {
+ streamExternalPlayer(entry, "hls");
+ } else if("raw".equals(videoPlayerType)) {
+ streamExternalPlayer(entry, "raw");
} else {
- streamExternalPlayer(entry, "raw".equals(videoPlayerType) ? "raw" : entry.getTranscodedSuffix());
+ streamExternalPlayer(entry, entry.getTranscodedSuffix());
}
}
protected void streamExternalPlayer(MusicDirectory.Entry entry, String format) {
@@ -917,7 +921,11 @@ public class SubsonicFragment extends SherlockFragment {
int maxBitrate = Util.getMaxVideoBitrate(context);
Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService(context).getVideoStreamUrl(format, maxBitrate, context, entry.getId())), "video/*");
+ if("hls".equals(format)) {
+ intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService(context).getHlsUrl(entry.getId(), maxBitrate, context)), "video/*");
+ } else {
+ intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService(context).getVideoStreamUrl(format, maxBitrate, context, entry.getId())), "video/*");
+ }
intent.putExtra("title", entry.getTitle());
List<ResolveInfo> intents = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java
index 8472281a..e9ee9bab 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java
@@ -236,6 +236,11 @@ public class CachedMusicService implements MusicService {
public String getVideoStreamUrl(String format, int maxBitrate, Context context, String id) throws Exception {
return musicService.getVideoStreamUrl(format, maxBitrate, context, id);
}
+
+ @Override
+ public String getHlsUrl(String id, int bitRate, Context context) throws Exception {
+ return musicService.getHlsUrl(id, bitRate, context);
+ }
@Override
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception {
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java
index 537ee2c2..7aa878ab 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java
@@ -95,6 +95,8 @@ public interface MusicService {
String getVideoUrl(int maxBitrate, Context context, String id);
String getVideoStreamUrl(String format, int Bitrate, Context context, String id) throws Exception;
+
+ String getHlsUrl(String id, int bitRate, Context context) throws Exception;
JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception;
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 0a3b0f55..22fdcd9b 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -516,6 +516,11 @@ public class OfflineMusicService extends RESTMusicService {
public String getVideoStreamUrl(String format, int maxBitrate, Context context, String id) throws Exception {
return null;
}
+
+ @Override
+ public String getHlsUrl(String id, int bitRate, Context context) throws Exception {
+ return null;
+ }
@Override
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception {
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java
index fddff16a..a6fb6248 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -723,6 +723,19 @@ public class RESTMusicService implements MusicService {
Log.i(TAG, "Using video URL: " + url);
return url;
}
+
+ @Override
+ public String getHlsUrl(String id, int bitRate, Context context) throws Exception {
+ checkServerVersion(context, "1.9", "HLS video streaming not supported.");
+
+ StringBuilder builder = new StringBuilder(Util.getRestUrl(context, "hls"));
+ builder.append("&id=").append(id);
+ builder.append("&bitRate=").append(bitRate);
+
+ String url = rewriteUrlWithRedirect(context, builder.toString());
+ Log.i(TAG, "Using hls URL: " + url);
+ return url;
+ }
@Override
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception {