Old-man rant

What's with playback controls in modern media players? I thought CD players had figured out these interfaces in the '80s: |<< (or alternatively |<) means "go to the previous track". They're not supposed to mean "go to the start of the previous track during the first unspecified amount of time of the current track, and after that go to the start of the current track instead". Who came up with this insanity, anyway?

And why is so difficult to find a player with time skip buttons? How am I supposed to use a seekbar when listening to a 2-hour podcast/radio program?
My rant would be that "modern" media players are more and more turning into advertising/selling platforms with built-in rudimentary playback capability...

Before:
http://edv-janssen.synology.me/windows-nation.de/win98/mplayer2.jpg

Now:
https://blogs.windows.com/wp-content/uploads/sites/2/2013/06/music_5F00_app_5F00_update_5F00_2CF24384.png


Anyway, implementing "seeking" or "time skipping" is not as simple as one might assume. For example, your standard MP3 file is just a sequence of audio blocks, no global header or seek tables or anything. Also, each block "contains" exactly 1152 audio samples (i.e. the duration per block is fixes), but the size of a block (in bytes) can vary, because MP3 allows for "variable" bitrates; actually there are a few pre-defined block-sizes (in bytes) that you can choose from. So, you can look at the first few blocks of the file and make an educated guess about the file's "average" bitrate from that. This then can be used generate a very rough "time position to file position" mapping, which allows for rudimentary seeking. But that's far from accurate... (there are things like the "Xing" header, but that's optional and non-standard)
Last edited on
Even if it's not trivial technically, it's still a solved a problem, many apps have a way to go forward/backwards a specified amount of time. I use Musicolet on my phone, which allows you to toggle the behavior mentioned with "start of track/previous track after X time".

Spotify has time skip buttons on their podcasts but not on normal music, which is incredibly annoying.
Have you tried vlc Player?
https://www.videolan.org/

I agree re Windows Media Player. I use the Windows 7 version on Windows 7 and 10 computers. Simples...

Last edited on
Anyway, implementing "seeking" or "time skipping" is not [...]
Nah, don't give me that. I've done it:
https://github.com/Helios-vmg/CopperRat/blob/master/src/app/jni/src/Mp3Decoder.cpp#L211
https://github.com/Helios-vmg/CopperRat/blob/master/src/app/jni/src/OggDecoder.cpp#L116
https://github.com/Helios-vmg/CopperRat/blob/master/src/app/jni/src/FLACDecoder.cpp#L91
It's pretty much a basic feature of any library, and compared to something like resampling audio to fit the sound device it's trivial.
MPC-HC is by far the best video player I've ever used. Ever. It's as simple as Window Media Player, but just better.

https://mpc-hc.org/

EDIT:

I just went down a rabbit hole seeing it wasn't updated since 2017 (sad) then seeing a github where people are actively updating and developing for it till this day (happy!):

https://github.com/clsid2/mpc-hc
Last edited on
Nah, don't give me that. I've done it:

Using a sophisticated decoder library, like mpg123, which hides the "gory" details, certainly makes things easier 😊

But even mpg123 cannot do "magic". You use mpg123_scan(), which will scan the entire file and build a seeking table for accurate seeking – probably the only way how accurate seeking can be done with MP3 files. Reading the entire file right at the beginning of playback may be okay in same scenarios, but I may be an unacceptable overhead or even impossible in other scenarios. Just saying...

then seeing a github where people are actively updating and developing for it till this day (happy!)
https://github.com/clsid2/mpc-hc

Definitely much recommended!

It should be noted that even though MPC-HC is built on DirectShow, it also comes with its own "built-in" LAVFilters, and thus supports pretty much all common audio/video/container formats out-of-the-box. So, no need to install a ton of separate "Codecs", "Splitters" and stuff.

https://github.com/Nevcairiel/LAVFilters

Spotify has time skip buttons on their podcasts but not on normal music, which is incredibly annoying.
Foobar2000, which is my favorite audio player, supports "time skip" too.

Just need to assign the "Seek ahead/back by N seconds" command to the hotkey (e.g. cursor keys) of your choice.


BTW: That moment when you want to "seek back by 10 seconds" very hard, but then you realize you are watching linear TV 🤦
Last edited on
Using a sophisticated decoder library, like mpg123, which hides the "gory" details, certainly makes things easier 😊
"Easier" compared to what? I don't have any reason to believe that other players use anything more rudimentary than this.

You use mpg123_scan(), which will scan the entire file and build a seeking table for accurate seeking – probably the only way how accurate seeking can be done with MP3 files.
The more relevant reason to scan the file is to fetch metadata, otherwise you can't even reliably show the time length, let alone the title or the cover.
Sample-accurate seeking is nice to have, but not required. Approximate seeking is basically fine. If I want to seek by 5 seconds but the decoder can only do either 4 or 6, that's acceptable.
Registered users can post here. Sign in or register to post.