aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/values/arrays.xml2
-rw-r--r--subsonic-android/res/values/strings.xml1
-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
7 files changed, 38 insertions, 2 deletions
diff --git a/subsonic-android/res/values/arrays.xml b/subsonic-android/res/values/arrays.xml
index daca9b8b..d6541f9f 100644
--- a/subsonic-android/res/values/arrays.xml
+++ b/subsonic-android/res/values/arrays.xml
@@ -139,11 +139,13 @@
<string-array name="videoPlayerValues">
<item>raw</item>
+ <item>hls</item>
<item>transcode</item>
<item>flash</item>
</string-array>
<string-array name="videoPlayerNames">
<item>@string/settings.video_raw</item>
+ <item>@string/settings.video_hls</item>
<item>@string/settings.video_transcode</item>
<item>@string/settings.video_flash</item>
</string-array>
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index e02383b0..39cdf075 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -318,6 +318,7 @@
<string name="settings.video_title">Video</string>
<string name="settings.video_player">Video Player</string>
<string name="settings.video_raw">Raw (Requires Subsonic 4.8+)</string>
+ <string name="settings.video_hls">HTTP Live Stream (HLS) (Requires Subsonic 4.8+)</string>
<string name="settings.video_transcode">Direct Transcode (Requires video -> mp4 or similar setup on Server)</string>
<string name="settings.video_flash">Flash (Requires Plugin)</string>
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 {