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

Add stream segments to player controls #5274

Merged
merged 1 commit into from Jan 15, 2021

Conversation

vkay94
Copy link
Contributor

@vkay94 vkay94 commented Dec 25, 2020

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

This PR adds stream segments for the YouTube service to player controls. The feature provides the following behaviors:

  • Highlights the current segment depending on the current position of the video (see Preview) / by click
  • Scrolls automatically to the current playing segment when the list is opened
  • Segments list is visible and the video is changed: if the new video has also segments then the new segments are loaded and it scrolls to the correct position, otherwise the list closes.

Code changes:

  • Adds a new button near to the top controls bar
  • Uses same layout elements like the play queue => they've been renamed to more generic id/field names, for example queueLayout to itemsListLayout

Fixes the following issue(s)

APK testing

Check the build artifact page for the debug apk.

Preview

Demo (dynamically changing at 0:22) : https://streamable.com/e/0v66wn

Due diligence

@vkay94 vkay94 force-pushed the stream-segments branch 3 times, most recently from 5b2452b to 5784568 Compare December 26, 2020 17:32
@vkay94 vkay94 marked this pull request as ready for review December 26, 2020 17:40
@TobiGr TobiGr added feature request Issue is related to a feature in the app GUI Issue is related to the graphical user interface player Issues related to any player (main, popup and background) labels Dec 27, 2020
@Orion983
Copy link

Orion983 commented Jan 2, 2021

eyy i opened the issue for this

@Orion983
Copy link

Orion983 commented Jan 9, 2021

Fun fact: these segments are named "YouTube Chapters"

@TobiGr
Copy link
Member

TobiGr commented Jan 11, 2021

Thanks for implementing that!

As you are using the layout used by the queue, please make sure to handlde swipe events differently. E.g. it is currently possible to remove segments from the list by swiping them to the right.

@Orion983
Copy link

Is this being added in the next version?

@Orion983 Orion983 mentioned this pull request Jan 11, 2021
3 tasks
@vkay94
Copy link
Contributor Author

vkay94 commented Jan 11, 2021

As you are using the layout used by the queue, please make sure to handlde swipe events differently. E.g. it is currently possible to remove segments from the list by swiping them to the right.

You're right, it starts to be possible whenever the queue was opened before. I'll address it tomorrow ;)
The overall layout (thumbnail size etc) is fine so far?

@Orion983
Copy link

The apk is corrupted it says if I click "app artifact" and If i extract the zip it says it's corrupted

@Orion983
Copy link

Hmm it let's ME review this. I won't do that unless you guys are ok with it

@vkay94
Copy link
Contributor Author

vkay94 commented Jan 12, 2021

@HTSamurai Hmm, I tried it and the zip seems to be fine (I just copied the URL to the file which is built automatically => checks tab). Probably trying to download it from there?

@Orion983
Copy link

I'll try that

@Orion983
Copy link

Yeah now it's fixed

@Orion983
Copy link

Am I allowed to do a review? It let's me, but I won't do it without consent

@TobiGr
Copy link
Member

TobiGr commented Jan 12, 2021

@HTSamurai sure

@vkay94 Layout looks good to me! One small suggestion: Add a title to the view, so users quickly understand what it is about

Screenshot

Orion983
Orion983 previously approved these changes Jan 12, 2021
Copy link

@Orion983 Orion983 left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@vkay94
Copy link
Contributor Author

vkay94 commented Jan 12, 2021

@TobiGr Done. I used TextAppearance.AppCompat.Medium as style, it's a little bit smaller than in your mock-up. I think it fits well.
@HTSamurai I just noticed that you've reviewed the code before the push (unfortunately I can't see them now, did you find something that should be changed?)

@Redirion
Copy link
Member

can you rebase your PR please? the upcoming release lacks of noteworthy changes/features. This PR could be it

@vkay94
Copy link
Contributor Author

vkay94 commented Jan 14, 2021

@Redirion Sure, I planed to do it today anyway

@Orion983
Copy link

@TobiGr Done. I used TextAppearance.AppCompat.Medium as style, it's a little bit smaller than in your mock-up. I think it fits well.
@HTSamurai I just noticed that you've reviewed the code before the push (unfortunately I can't see them now, did you find something that should be changed?)

No I didn't find anything that should be changed. All was well

@Stypox
Copy link
Member

Stypox commented Jan 14, 2021

Happy rebasing! ;-)
(sorry, don't kill me for making #5371, please)

@vkay94
Copy link
Contributor Author

vkay94 commented Jan 14, 2021

@Stypox No problem, at least it wasn't that much (but I had to do it twice because I clicked on "skip commit" during rebasing accidentally :') )

@Redirion
Copy link
Member

Redirion commented Jan 14, 2021

startTimeSeconds.toLong()
fun secondsToString(seconds: Long): String
startTimeSeconds * 1000L
getStartTimeSeconds() * 1000
int getNearestStreamSegmentPosition(final long playbackPosition)

I think these can safely reduced to int. We don't need the ms precision that is returned by simpleExoPlayer.getCurrentPosition() and we use int everywhere else.

@vkay94
Copy link
Contributor Author

vkay94 commented Jan 14, 2021

@Redirion Good point, I didn't pay attention to it in the other places, I'll adjust it then.
Edit: I changed the passed startTimeSeconds to int. For the other places the milliseconds value is required for seeking and comparison (I pass 2 of 3 times 'simpleExoPlayer.getCurrentPosition()' to getNearestStreamSegmentPosition which is Long, so it should be fine).

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 like the changes, just a few small issues. Thank you! :-D
Run Ctrl+Shift+Alt+L in the player.xml files after you are done, to reorder attributes

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.

Looks good to me, thank you for this great feature!
Maybe let's wait for somebody else to review, though, this is a pretty big change ;-)
Edit: I didn't test 😨

@Redirion
Copy link
Member

Tested, looking good

@Redirion Redirion merged commit 98ed80d into TeamNewPipe:dev Jan 15, 2021
@opusforlife2
Copy link
Collaborator

the upcoming release lacks of noteworthy changes/features

@Redirion "Am I dead to you!?" ~ PeerTube Sepia Search.

@vkay94 vkay94 deleted the stream-segments branch January 16, 2021 12:08
This was referenced Jan 18, 2021
@opusforlife2 opusforlife2 added the youtube Service, https://www.youtube.com/ label Jan 23, 2021
@opusforlife2 opusforlife2 linked an issue Jan 23, 2021 that may be closed by this pull request
@opusforlife2
Copy link
Collaborator

@vkay94 When did you last open Matrix? Please check your messages.

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 GUI Issue is related to the graphical user interface player Issues related to any player (main, popup and background) youtube Service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Segmented videos Youtube chapter support
6 participants