iBicha / playlet

The unofficial, privacy driven, YouTube client for Roku
GNU Affero General Public License v3.0
280 stars 11 forks source link

OK button as Play/Pause #307

Closed cexcell closed 4 months ago

cexcell commented 4 months ago

First OK press now shows Video UI. It's achievable via hidden Roku Video node property showUI, which allows you to override how trickplay should be displayed by specifying parts of the UI to be rendered (like 'titleAndTime', 'trickplayBar', e.t.c). A timer is started every time custom UI is shown to prevent UI from staying forever.

Second OK press while UI is visible pauses the video (pause poster animation is not added yet).

However, since we shouldn't break default OK button actions, we must track whether user is seeking in video UI and if they do, fallback to Video internal OK handler.

Also, auto-formatted VideoPlayer.xml

iBicha commented 4 months ago

Thanks for the PR! This seems to cover ##296 well. I do have some concerns about:

It's the edge cases that led me to believe implementing this after a full Video node UI rewrite would be more sane https://github.com/iBicha/playlet/issues/296#issuecomment-1953409980. I suspect there's probably more edge cases that I didn't find yet. It's just going to be hard when complex state is managed by two systems, and one of them is obscure.

But if you can correct the more obvious edge cases, then by all means I'll be here to help push it forward! Let me know what you want to do

Edit: Screenshot of thumbnails stuck but video is playing (screenshot functionality does not capture video, and is set to black, but the video is playing) thumbnail-bug

cexcell commented 4 months ago

Thank you for your feedback.

For example, you set m.top.showUI = { "show": true, "trickPlaybar": true, "titleAndTime": true, "trickplayBackgroundOverlay": true, "focusTrickplayBar": false }. But if Roku introduces a new UI element to the default player, then we will be overriding the showUI with incorrect state

You're right, that's a major downside of using undocumented fields, but the other option is to use video.trickplayBar, video.bifDisplay and create a custom controller with animations for them. Or like you said, a whole new UI layer that simply ignores standard Roku trickplay ui, but that's a bit out of scope for this change :-) The only protection here is that we can just check if showUI field actually exists, before proceeding with our custom OK handler.

Handling Live videos. This adds some weird behaviour

Let me check those, I've got some weird connectivity issues with my TV in the bedroom. Didn't intend to introduce unwanted behavior :-) Live video should be handled separately

Trickplay thumbnails can be stuck after the UI is hidden (see screenshot). To reproduce:

Yeah, missed that, will fix

Another edge case where the UI can remain visible after the timer

Ooops, let me try to fix that. But I believe if you do that w/o my changes (just leave it to default Roku UI behavior) title and time won't disappear either, I believe that's a Roku Video node bug, but again, I can be wrong.

Quick question: do you want me to add a pause poster splash like Roku has be default when video is paused?

cexcell commented 4 months ago

I hope my latest commit fixes some of the issues. For some reason I cannot load thumbnails, so couldn't verify that :-(

Also, there is an internal Roku UI timer (~6 seconds) that hides UI automatically, so there is an inevitable overlapping, like:

  1. Press Play button to pause the video.
  2. Press OK to resume it after waiting for about 3 seconds.
  3. Press OK to show trickplay UI again.
  4. UI will be automatically hidden after ~2 - 3 seconds, because Roku internal timer was still ticking.

That's something that workaround patches like this one won't be able to fix.

iBicha commented 4 months ago

Thanks for making the changes! I think another change related to the live check might be it

But I believe if you do that w/o my changes (just leave it to default Roku UI behavior) title and time won't disappear either, I believe that's a Roku Video node bug, but again, I can be wrong.

I tried on your first version, and saw the bug, then without the change, no bug. But then tried again without your PR, and the UI got stuck. So perhaps it's a bug in the Video node itself, but it's not consistent

For some reason I cannot load thumbnails, so couldn't verify that :-(

Thumbnails only show when using video quality Auto (DASH) - perhaps you have something else in the settings?

Quick question: do you want me to add a pause poster splash like Roku has be default when video is paused?

No need, that's just a cosmetic thing. If we can add this feature without any major bug/side effect, then it's good by me

The new changes seem to do the trick from initial testing

cexcell commented 4 months ago

So perhaps it's a bug in the Video node itself, but it's not consistent

I'm now hiding UI when we do any scaling for video node just to avoid any stale elements, so it shouldn't matter ( at least in theory)

cexcell commented 4 months ago

Thanks for the PR and for addressing all the comments!

You're welcome! Hopefully this doesn't introduce any serious regressions