Add option to play youtube URLs on Kodi
This commit is contained in:
parent
7d19a43b61
commit
a70f766442
|
@ -29,6 +29,16 @@
|
|||
<data android:mimeType="text/plain"/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- Intent filter for sharing youtube URLs -->
|
||||
<intent-filter android:label="@string/play_on_kodi">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="http" android:host="youtube.com"/>
|
||||
<data android:scheme="http" android:host="m.youtube.com"/>
|
||||
<data android:scheme="http" android:host="www.youtube.com"/>
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity android:name="org.xbmc.kore.ui.hosts.HostManagerActivity"/>
|
||||
|
|
|
@ -321,12 +321,22 @@ public class RemoteActivity extends BaseActivity
|
|||
*/
|
||||
private void handleStartIntent(Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
LogUtils.LOGD(TAG, "Action: " + action);
|
||||
LogUtils.LOGD(TAG, "Data: " + intent.getData());
|
||||
// Check action
|
||||
if ((action == null) || !action.equals(Intent.ACTION_SEND)) return;
|
||||
if ((action == null) ||
|
||||
!(action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_VIEW)))
|
||||
return;
|
||||
|
||||
// Get the URI, which is stored in Extras
|
||||
final Uri youTubeUri = getYouTubeUri(intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||
if (youTubeUri == null) return;
|
||||
Uri youTubeUri = null;
|
||||
if (action.equals(Intent.ACTION_SEND)) {
|
||||
// Get the URI, which is stored in Extras
|
||||
youTubeUri = getYouTubeUri(intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||
if (youTubeUri == null) return;
|
||||
} else if (action.equals(Intent.ACTION_VIEW)) {
|
||||
if (intent.getData() == null) return;
|
||||
youTubeUri = Uri.parse(intent.getData().toString());
|
||||
}
|
||||
|
||||
final String videoId = getYouTubeVideoId(youTubeUri);
|
||||
if (videoId == null) return;
|
||||
|
|
Loading…
Reference in New Issue