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

Long-click on stream segment to share timestamped url #9203

Merged
merged 2 commits into from
Oct 30, 2022

Conversation

Callisto404
Copy link

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Added the ability to share timestamped links starting from the beginning of a particular chapter when the user long clicks on them

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, looks almost good

Are you an ANU student with the strict deadline on the 31st of October?

Comment on lines +713 to +716
String videoUrl = player.getVideoUrl();
videoUrl += ("&t=" + seconds);
ShareUtils.shareText(context, currentItem.getTitle(),
videoUrl, currentItem.getThumbnailUrl());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work for services other than YouTube. You should use the same logic as in the player:

final long timeSeconds = simpleExoPlayer.getCurrentPosition() / 1000;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey sorry for clarification, do you mean that I should be surrounding line 714 with an if statement checking that the service ID is indeed YouTube? I did look at this part in the player but thought it might not be necessary since I thought that these click handlers on the segments would only ever be called from a YouTube service. Sorry if I am misunderstanding and thanks for the quick replies!
And yes I am an ANU student :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that these click handlers on the segments would only ever be called from a YouTube service

That's probably true, but who knows if a future service will support segments ;-)

Yes, sorround it with a "is youtube" check. If it's not YouTube, don't allow long-pressing the item at all.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I have been attempting to add this check to the buildSegements function with setLongClickable(false), however even with setOnLongClickListener(null), the long click event still occurs. Similarly, the existing onClick method used for seeking to different chapters does not get disabled by setting clickable to false. I have also tried adding the check to the beginning of the long click call, however since the call consumes the click event, this is not the desired result.

don't allow long-pressing the item at all.

Is there some better way of doing this that I am unaware of? Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then it's fine if you just don't do anything when a long-press is detected but the url is non-youtube

@SameenAhnaf SameenAhnaf added feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background) labels Oct 29, 2022
@sonarcloud
Copy link

sonarcloud bot commented Oct 30, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and it works well. Thank you and good luck with the exams! ;-)

@Stypox Stypox merged commit 9d2ab61 into TeamNewPipe:dev Oct 30, 2022
@Stypox Stypox changed the title Added timestamped link sharing from the start of a chapter with a long hold press Long-click on stream segment to share timestamped url Oct 30, 2022
@Callisto404 Callisto404 deleted the add-chapter-timestamp-share branch October 31, 2022 07:18
This was referenced Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chapter timestamp share
4 participants