From f0cd9a67f841f91951f458b5a50e72092f3b58fb Mon Sep 17 00:00:00 2001 From: noctux Date: Tue, 18 Oct 2016 20:06:41 +0200 Subject: [PATCH] Support playback of shared plain http-video urls (#292) Currently Kore does only support the playback of youtube and vimeo video urls when invoked via the "Play with Kodi" share menu. This commit adds support for plain video urls. --- .../java/org/xbmc/kore/ui/RemoteActivity.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/xbmc/kore/ui/RemoteActivity.java b/app/src/main/java/org/xbmc/kore/ui/RemoteActivity.java index 8e3dc31..9ddd5ff 100644 --- a/app/src/main/java/org/xbmc/kore/ui/RemoteActivity.java +++ b/app/src/main/java/org/xbmc/kore/ui/RemoteActivity.java @@ -386,17 +386,18 @@ public class RemoteActivity extends BaseActivity } final String videoId = getVideoId(videoUri); - if (videoId == null) { - Toast.makeText(RemoteActivity.this, - R.string.error_share_video, - Toast.LENGTH_SHORT).show(); - return; - } - - final String kodiAddonUrl = "plugin://plugin.video." + + String videoUrl; + if (videoId != null) { + videoUrl = "plugin://plugin.video." + (videoUri.getHost().endsWith("vimeo.com") ? "vimeo" : "youtube") + "/play/?video_id=" + videoId; + } else { + videoUrl = videoUri.toString(); + } + + final String fvideoUrl = videoUrl; + // Check if any video player is active and clear the playlist before queuing if so final HostConnection connection = hostManager.getConnection(); final Handler callbackHandler = new Handler(); @@ -413,9 +414,9 @@ public class RemoteActivity extends BaseActivity if (!videoIsPlaying) { // Clear the playlist - clearPlaylistAndQueueFile(kodiAddonUrl, connection, callbackHandler); + clearPlaylistAndQueueFile(fvideoUrl, connection, callbackHandler); } else { - queueFile(kodiAddonUrl, false, connection, callbackHandler); + queueFile(fvideoUrl, false, connection, callbackHandler); } }