This commit is contained in:
Thomas 2021-01-09 10:42:37 +01:00
parent 346656e53d
commit 9b322cc922
1 changed files with 15 additions and 8 deletions

View File

@ -220,6 +220,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private boolean willPlayFromIntent;
private String chromeCastVideoURL;
private app.fedilab.fedilabtube.client.mastodon.Status status;
Uri captionURI;
String captionLang;
public static void hideKeyboard(Activity activity) {
if (activity != null && activity.getWindow() != null) {
@ -664,7 +666,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
secInt = Integer.parseInt(sec.replace("s", ""));
totalSeconds += secInt;
}
captionURI = null;
captionLang = null;
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.
@ -1018,7 +1021,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
secInt = Integer.parseInt(sec.replace("strue", ""));
totalSeconds += secInt;
}
captionURI = null;
captionLang = null;
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.
@ -1941,11 +1945,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
binding.mediaVideo.player(player);
binding.doubleTapPlayerView.setPlayer(player);
binding.loader.setVisibility(View.GONE);
startStream(
peertube,
null,
res,
true, position, null, null, false);
true, position, captionURI, captionLang, false);
}
break;
case SPEED:
@ -1957,7 +1962,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
break;
case CAPTION:
Uri uri = null;
Caption captionToUse = null;
for (Caption caption : captions) {
if (caption.getLanguage().getId().compareTo(item.getStrId()) == 0) {
@ -1967,10 +1971,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
}
if (captionToUse != null) {
if (!sepiaSearch) {
uri = Uri.parse("https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + captionToUse.getCaptionPath());
captionURI = Uri.parse("https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + captionToUse.getCaptionPath());
} else {
uri = Uri.parse("https://" + peertubeInstance + captionToUse.getCaptionPath());
captionURI = Uri.parse("https://" + peertubeInstance + captionToUse.getCaptionPath());
}
} else {
captionURI = null;
}
currentCaption = item.getStrId();
long newPosition = player.getCurrentPosition();
@ -1982,14 +1988,15 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
player = new SimpleExoPlayer.Builder(PeertubeActivity.this).setTrackSelector(trackSelector).build();
binding.mediaVideo.player(player);
binding.doubleTapPlayerView.setPlayer(player);
captionLang = item.getStrId();
startStream(
peertube,
null,
null,
true,
newPosition,
uri,
item.getStrId(),
captionURI,
captionLang,
false
);
break;