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 scrub function to audio trickplay bar #1622

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

1hitsong
Copy link
Member

@1hitsong 1hitsong commented Jan 7, 2024

Changes

Adds scrub ability to audio player. Users can press up from the buttons on the audio player view to focus the trickplay bar and using left/right on their remote, seek through the audio and select a new timestamp.

Notes:
When scrubbing, audio will pause.
After scrubbing, the audio must rebuffer, so we show a loading spinner until audio is ready for playback.

Demo

https://social.linux.pizza/@tgpo/111712110018347240

@1hitsong 1hitsong added the new-feature A new feature that currently doesn't exist. label Jan 7, 2024
@1hitsong 1hitsong requested a review from a team as a code owner January 7, 2024 01:27
@jellyfin-bot jellyfin-bot added this to In progress in Ongoing development Jan 7, 2024
@michaelcresswell
Copy link

Certain songs in my library do not seek properly, with the reported playback position not matching the audio playback. Not all songs exhibit this behavior.

My test steps have been:

  1. Seek as close to the end of the song as possible
  2. Press Ok
  3. In my case, the player indicated it was at 3:21 out of a 3:26 song but the audio being played back was from minutes earlier (meaning far more than five seconds remain)
    ok
  4. Allow player to play the all remaining audio
  5. Playback continues well beyond 3:26, in this case getting to 5:57 out of 3:26 when the audio playback reached the end
    bad

The ffprobe of the song used in the test steps that does exhibit this behavior:

ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
...
Input #0, mp3, from '<path_to_file>':
  Metadata:
    <metadata tags>
  Duration: 00:03:26.55, start: 0.025056, bitrate: 265 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 263 kb/s
    Metadata:
      encoder         : Lavc58.35
  Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 600x600 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Cover (front)

The most similar looking ffprobe I could find of a song that does not exhibit this behavior:

ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
...
Input #0, mp3, from '<path_to_file>':
  Metadata:
    <metadata tags>
  Duration: 00:03:47.11, start: 0.025056, bitrate: 349 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      encoder         : Lavc58.35
  Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 1440x1440 [SAR 118:118 DAR 1:1], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Other

@michaelcresswell
Copy link

michaelcresswell commented Jan 7, 2024

General UX Feedback :

  1. Play/pause from the remote do not work while the trickplay bar is in focus.
  2. It'd be nice if holding left/right on the remote seeked continuously so you don't have to press them over and over. Especially for longer songs.

@lakerssuperman
Copy link

I did a quick test and from what I saw songs I played skipped to spots correctly and the time seemed to be reported correctly. I didn't seem to be able to skip past the end of any of the songs I tried. In fact, it seems that I can skip only to two seconds prior to the end of the track, which seems like a safe place to stop and let playback complete. I will test more later.

@1hitsong
Copy link
Member Author

1hitsong commented Jan 8, 2024

1. Play/pause from the remote do not work while the trickplay bar is in focus.

In the updated version, if the trickplay bar is in focus, but you haven't scrubbed, the Play/Pause button works on normal. If you do scrub, the button seeks audio to the new location.

2. It'd be nice if holding left/right on the remote seeked continuously so you don't have to press them over and over. Especially for longer songs.

I originally had this, but Roku being Roku, it only triggered the button 3 times then quit. I'll keep looking into it, but for now this is they best I've got.

@michaelcresswell
Copy link

  1. After 03b2768, the same problem songs still don't seek 100% accurately but they're a lot closer that they were before.
    (After seeking, playback may end at 3:36 ---o 3:26 instead of 5:57 ---o 3:26)

  2. On the same problem songs, if I seek to within a few seconds of the end, playback doesn't start after pressing any of Ok on the remote, Play on the remote, or the play button on the client. However, I can still seek and:

  • Seeking earlier results in playback that is close to but not 100% accurate.
  • Moving the trickbar earlier, back to the same time, and pressing Ok again (to retry playback at the time that didn't work the first time around) results in a loading spinner that never goes away and requires exiting the Jellyfin client

@1hitsong
Copy link
Member Author

1hitsong commented Jan 9, 2024

@michaelcresswell I tested dozens of my music files and I can't recreate this issue. Can you share one of the trouble files with me?

@michaelcresswell
Copy link

Any mp3 I’ve purchased from Amazon does it for me. I tried trimming down to a sample size but I don’t see the issue with any of the samples I created. I’m not keen on sharing copyrighted material in its entirety.

Seeking for these files works as expected in the web client, iOS (expo), and Finamp so it seems like something odd is going on with Roku but I can’t identify the cause. I’m okay with moving this to a bug and seeing if anyone else reports similar behavior.

The rest of my library seeks properly, for what it’s worth.

@1hitsong
Copy link
Member Author

1hitsong commented Jan 9, 2024

Cool. I've got a ton of Amazon songs. I'll dl them and see what I can recreate.

@1hitsong
Copy link
Member Author

1hitsong commented Jan 9, 2024

I was able to recreate some strangeness using an Amazon MP3 file on Roku.

I then tested the file in other players, and using Windows Media Player I skipped to the last second of the song and it locked up the program. I then tried it again and ended up with a popup from Windows Media Player saying the file was encoded with unsupported encoding settings. It seems Amazon may be doing something non-standard with their files.

image

@1hitsong
Copy link
Member Author

1hitsong commented Jan 9, 2024

I tested the file in Roku Media Player and it also had many issues. It had trouble getting the correct song length, it attempted to seek past the end, it attempted to play past the end of the file.

In my mind, that means it's an issue playing the file itself and not the code in the PR.

Yes, open a bug with this info and make note it's an Amazon sourced MP3 file.

@michaelcresswell
Copy link

Awesome that you were able to reproduce the problem. I beginning to think the problem was on my end.

I made #1629 to capture the playback issue discussion.

@jimdogx
Copy link
Contributor

jimdogx commented Jan 27, 2024

When using the scrub feature, the time gets out of sync. Example:

Play a song that is 3:17 long. Notice with no scrubbing it ends at 3:17.
Play a song that is 3:17 long. Scrub to the middle. Let song play to the end. Notice the song ends past 3:17.

track-time

Copy link
Contributor

@jimdogx jimdogx left a comment

Choose a reason for hiding this comment

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

I'm approving this as it works with "known issues" (that may or may not be resolvable). And having this feature outweighs the issue in my opinion.

Ongoing development automation moved this from In progress to Reviewer approved Jan 30, 2024
@1hitsong 1hitsong merged commit 7de5e68 into jellyfin:master Jan 31, 2024
11 checks passed
Ongoing development automation moved this from Reviewer approved to Done Jan 31, 2024
@1hitsong 1hitsong deleted the musicTrickBar branch January 31, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A new feature that currently doesn't exist.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants