Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timestamp from share url for all services except youtube #5228

Merged
merged 1 commit into from
Dec 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@

import java.util.List;

import static org.schabi.newpipe.extractor.ServiceList.YouTube;
import static org.schabi.newpipe.player.MainPlayer.ACTION_CLOSE;
import static org.schabi.newpipe.player.MainPlayer.ACTION_FAST_FORWARD;
import static org.schabi.newpipe.player.MainPlayer.ACTION_FAST_REWIND;
Expand Down Expand Up @@ -889,10 +890,17 @@ private void onMoreOptionsClicked() {
private void onShareClicked() {
// share video at the current time (youtube.com/watch?v=ID&t=SECONDS)
// Timestamp doesn't make sense in a live stream so drop it
final String ts = isLive() ? "" : ("&t=" + (getPlaybackSeekBar().getProgress() / 1000));

final int ts = getPlaybackSeekBar().getProgress() / 1000;
final MediaSourceTag metadata = getCurrentMetadata();
String videoUrl = getVideoUrl();
if (!isLive() && ts >= 0 && metadata != null
&& metadata.getMetadata().getServiceId() == YouTube.getServiceId()) {
videoUrl += ("&t=" + ts);
}
ShareUtils.shareUrl(service,
getVideoTitle(),
getVideoUrl() + ts);
videoUrl);
}

private void onPlayWithKodiClicked() {
Expand Down