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