xbmc icon indicating copy to clipboard operation
xbmc copied to clipboard

Starting file playback with keyboard Enter button is broken in master

Open smp79 opened this issue 1 year ago • 30 comments

Bug report

Describe the bug

Here is a clear and concise description of what the problem is:

Starting playback in file mode with Enter button seems broken.

Expected Behavior

Here is a clear and concise description of what was expected to happen:

Keyboard Enter button should start the playback of any video file in the folder.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a folder with multiple video files
  2. Select any file and press Enter
  3. Playback would start but it would start from the first file in the folder, regardless of which file is actually selected.

Debuglog

The debuglog can be found here: debug log

Screenshots

Here are some links or screenshots to help explain the problem:

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

  • [ ] Android

  • [ ] iOS

  • [ ] tvOS

  • [x] Linux

  • [ ] macOS

  • [ ] Windows

  • [ ] Windows UWP

  • Operating system version/name: LibreELEC

  • Kodi version: current master

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required. Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

smp79 avatar Apr 30 '24 17:04 smp79

Hmm, can't reproduce, starts the selected file when browsing via the file manager in the settings or opening a video source as a folder.

neo1973 avatar Apr 30 '24 19:04 neo1973

I just re-tested with videos on a USB drive. Videos->Files->.... Same issue. Will try to figure out which commit broke it.

smp79 avatar Apr 30 '24 20:04 smp79

It's #24720. No issue after building without that PR.

smp79 avatar Apr 30 '24 21:04 smp79

It's https://github.com/xbmc/xbmc/pull/24720. No issue after building without that PR.

@78andyp can you please have a look and fix the regression? Would be a good chance to address the other things we would like you to change in the code you changed for that PR.

ksooo avatar Apr 30 '24 21:04 ksooo

Many apologies and thanks for reporting. Looking now.

78andyp avatar Apr 30 '24 22:04 78andyp

Hi @smp79

I've not managed to reproduce yet.

Can I ask:

  • looking at the log it looks like you are trying to play smb://192.168.1.2/MEDIA/1/hdr/(HDR HEVC 10-bit BT.2020 59.940fps) Camp by Sony.mp4 - is that really the file you are trying to play or the first file in the folder that plays instead??
  • does it work if you select the file by clicking (or something other than pressing enter)?? (I'm confused if this is the case as I haven't knowingly changed anything that would cause this)
  • Are you trying to use 'Play from Here' by any chance - as I did alter that code??

Otherwise - to try and reproduce i've done the following:

  • Fresh build of master (I know I am win64 and you are libreelec)
  • New local database
  • SMB directory with 4 mp4 files - all different names/movies - navigate there with keyboard (Videos -> Files -> select source -> select directory -> highlight file with arrow keys and press enter
  • (NB sources predefined in sources.xml)
  • Works for all files
  • Also copied the files to USB stick and did the same
  • Works for all files.

78andyp avatar Apr 30 '24 23:04 78andyp

...Camp by Sony.mp4 is the first file in the folder, I tried to play another file. It works fine if I select the file, press C, then select Play in the context menu. I don't use "Play from here"

smp79 avatar Apr 30 '24 23:04 smp79

Thank you. Could you share the name of the file you were trying to play - and i'll try and reproduce directory exactly.

78andyp avatar Apr 30 '24 23:04 78andyp

https://youtu.be/D4gjFrA1I0g

smp79 avatar Apr 30 '24 23:04 smp79

No issue with Windows nightly. Maybe something Linux-specific?

smp79 avatar May 01 '24 00:05 smp79

Possibly.

There might be a problem in CGUIMediaWindow::OnPlayAndQueueMedia

Are you able to generate a test build with #25099 added?? It's just some logging a) to see if it gets triggered and b) to see if then identifies the issue.

I can reproduce if I select play from here in a folder with multiple items - it always plays the first - because it seems that p->GetVideoInfoTag()->m_basePath is actually empty.

Is it possible that pressing eneter in Linux triggers something different to pressing enter in Windows??

Thanks

78andyp avatar May 01 '24 00:05 78andyp

No issue with Windows nightly. Maybe something Linux-specific?

I tested on Linux and don't see the issue, so the difference is probably somewhere else?

neo1973 avatar May 01 '24 03:05 neo1973

Thanks @smp79. That debug log the problem in OnPlayAndQueueMedia. Not sure why that get called in your situation as here it's only called on play from here. Will fix and update #25099.

78andyp avatar May 01 '24 08:05 78andyp

Hi @smp79. Could you try now with the updated #25099. Thanks.

78andyp avatar May 01 '24 13:05 78andyp

The updated #25099 fixed it! 👍

smp79 avatar May 01 '24 13:05 smp79

The updated #25099 fixed it! 👍

Brilliant. Thanks for letting us know. I still have no idea (as I am really not familiar with Linux) as to why pressing enter seems to invoke a different pathway to clicking play. Out of interest - when you select a video by pressing enter does it automatically play the subsequent videos??

78andyp avatar May 01 '24 13:05 78andyp

Out of interest - when you select a video by pressing enter does it automatically play the subsequent videos??

Yes, the subsequent videos are played automatically, as long as "Play next video automatically" is enabled

smp79 avatar May 01 '24 13:05 smp79

This can be controlled via a setting.

ksooo avatar May 01 '24 13:05 ksooo

Out of interest - when you select a video by pressing enter does it automatically play the subsequent videos??

Yes, the subsequent videos are played automatically, as long as "Play next video automatically" is enabled

Thanks. I missed that. So if you select play from the context menu should that mean they play automatically as well?? (As it worked correctly with the buggy code it would suggest that they won't play automatically)

78andyp avatar May 01 '24 13:05 78andyp

Yes, the subsequent videos are played automatically

Ah, you mean without the fix? I just tried to play it without the fix, it actually doesn't automatically play the next video. Playback just stops.

smp79 avatar May 01 '24 13:05 smp79

Both with and without the fix

78andyp avatar May 01 '24 13:05 78andyp

With the fix the next video plays automatically, as it should

smp79 avatar May 01 '24 13:05 smp79

Starting playback via context menu works correctly with and without the fix, the next video plays automatically in both cases

smp79 avatar May 01 '24 13:05 smp79

Brilliant. Although that leads to another question (in my mind - and I'm new to this so the answer may be obvious). If automatic is enabled then don't Play and Play from here on the context menu do exactly the same thing?? Should one be removed?? Should play only play the single item irrespective of toggle??

ie. Enter = play or play from here depending on automatic toggle Context Play = play single always Context Play from here = play item and remaining automatically always

78andyp avatar May 01 '24 13:05 78andyp

If automatic is enabled "Play from here" is replaced with "Play only this"

smp79 avatar May 01 '24 14:05 smp79

Exactly, depending on the setting value "Play" does different things. If it is enabled, "Play" is actually a 'play from here'. If it is disabled, "Play" performs a 'play only this'. Dependent on the setting value there is always one more item, either "Play only this" or "Play from here", doing the opposite of "Play".

ksooo avatar May 01 '24 14:05 ksooo

Thanks for the clarification.

78andyp avatar May 01 '24 14:05 78andyp

I just noticed that the issue is triggered only when "Play next video automatically" is enabled. I can reproduce it on Windows too

smp79 avatar May 01 '24 14:05 smp79

Or if you select play from here. The code in CGUIMediaWindow::OnPlayAndQueueMedia is what generates the playlist.

78andyp avatar May 01 '24 14:05 78andyp