Added support for Prime Videos shared from the official Amazon app

This commit is contained in:
Francesco Bonazzi 2020-03-22 17:57:49 +01:00 committed by Martijn Brekhof
parent c44a5f0612
commit 5f0ca05eeb
1 changed files with 21 additions and 0 deletions

View File

@ -390,6 +390,21 @@ public class RemoteActivity extends BaseActivity
videoUri = intent.getData(); videoUri = intent.getData();
} }
if (videoUri == null) {
// Some apps hide the link in the clip, try to detect any link by casting the intent
// to string a looking with a regular expression:
Matcher matcher = Pattern.compile("https?://[^\\s]+").matcher(intent.toString());
String matchedString = null;
if (matcher.find()) {
matchedString = matcher.group(0);
if (matchedString.endsWith("}")) {
matchedString = matchedString.substring(0, matchedString.length() - 1);
}
videoUri = Uri.parse(matchedString);
}
}
String url; String url;
if (videoUri == null) { if (videoUri == null) {
url = getShareLocalUri(intent); url = getShareLocalUri(intent);
@ -598,6 +613,12 @@ public class RemoteActivity extends BaseActivity
} else if (host.endsWith("soundcloud.com")) { } else if (host.endsWith("soundcloud.com")) {
return "plugin://plugin.audio.soundcloud/play/?url=" return "plugin://plugin.audio.soundcloud/play/?url="
+ URLEncoder.encode(playuri.toString()); + URLEncoder.encode(playuri.toString());
} else if (host.startsWith("app.primevideo.com")) {
Matcher amazonMatcher = Pattern.compile("gti=([^&]+)").matcher(playuri.toString());
if (amazonMatcher.find()) {
String gti = amazonMatcher.group(1);
return "plugin://plugin.video.amazon-test/?asin=" + gti + "&mode=PlayVideo&adult=0&name=&trailer=0&selbitrate=0";
}
} }
return null; return null;
} }