Fix issue #91
This commit is contained in:
parent
3351ef7d91
commit
91a1380fef
|
@ -504,11 +504,29 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
private void manageIntentUrl(Intent intent) {
|
||||
if (intent.getData() != null) { //Comes from a link
|
||||
String url = intent.getData().toString();
|
||||
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$");
|
||||
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})(\\?start=(\\d+[hH])?(\\d+[mM])?(\\d+[sS])?)?$");
|
||||
Matcher matcherLink = link.matcher(url);
|
||||
if (matcherLink.find()) {
|
||||
String instance = matcherLink.group(1);
|
||||
String uuid = matcherLink.group(2);
|
||||
String hour = matcherLink.group(4);
|
||||
String min = matcherLink.group(5);
|
||||
String sec = matcherLink.group(6);
|
||||
int hourInt, minInt, secInt;
|
||||
int totalSeconds = 0;
|
||||
if (hour != null) {
|
||||
hourInt = Integer.parseInt(hour.replace("h", ""));
|
||||
totalSeconds += 3600 * hourInt;
|
||||
}
|
||||
if (min != null) {
|
||||
minInt = Integer.parseInt(min.replace("m", ""));
|
||||
totalSeconds += 60 * minInt;
|
||||
}
|
||||
if (sec != null) {
|
||||
secInt = Integer.parseInt(sec.replace("s", ""));
|
||||
totalSeconds += secInt;
|
||||
}
|
||||
|
||||
if (instance != null && uuid != null) {
|
||||
peertubeInstance = instance.replace("https://", "").replace("http://", "");
|
||||
sepiaSearch = true; // Sepia search flag is used because, at this time we don't know if the video is federated.
|
||||
|
@ -516,6 +534,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
peertube = new VideoData.Video();
|
||||
peertube.setUuid(uuid);
|
||||
peertube.setEmbedUrl(url);
|
||||
if (totalSeconds > 0) {
|
||||
VideoData.UserHistory userHistory = new VideoData.UserHistory();
|
||||
userHistory.setCurrentTime(totalSeconds * 1000);
|
||||
peertube.setUserHistory(userHistory);
|
||||
}
|
||||
SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
|
||||
viewModelSearch.getVideos("0", peertube.getEmbedUrl()).observe(PeertubeActivity.this, this::manageVIewVideos);
|
||||
} else {
|
||||
|
@ -1117,10 +1140,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
|
||||
@Override
|
||||
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
|
||||
if (isInPictureInPictureMode) {
|
||||
fullScreenMode = true;
|
||||
} else {
|
||||
fullScreenMode = false;
|
||||
if (!isInPictureInPictureMode) {
|
||||
if (onStopCalled) {
|
||||
isPlayInMinimized = false;
|
||||
finishAndRemoveTask();
|
||||
|
|
Loading…
Reference in New Issue