podigee / podigee-podcast-player

Podcast Web Player
https://www.podigee.com/en/podcast-player
MIT License
207 stars 41 forks source link

Use millisecond precision when switching between chapters #26

Open benzimmer opened 7 years ago

benzimmer commented 7 years ago

Currently switching chaptermarks while playing disregards milliseconds and might switch marks too early or too late.

benzimmer commented 7 years ago

I recently came accross the (very probable) reason for this: The event the MediaElement (the thing that is responsible for playing the audio in the browser) sends during it plays and which we use to determine the current time and therefore the timing when to switch between chapters does not come in "regular" intervals but depends on how the browser implements the API (https://developer.mozilla.org/en-US/docs/Web/Events/timeupdate). Most of them seem to update with a 4hz frequency (so ~250+ms).

Currently I'm not sure if the effect it would have would be worth investing the time to fix it. Leaving this issue open though.

alexander-heimbuch commented 7 years ago

You are totally right that this highly depends on the browser implementation (especially iOS Safari is highly imprecise ~.~). Don't know what audio element wrapper you folks using, we implemented this one: https://github.com/podlove/html5-audio-driver. At Podlove Player each chapters start is associated with a transformed timestamp up to milliseconds. On chapter interaction the currentTime of the chapter in milliseconds is set. This at least gives the media element the chance to start at chapters beginning in milliseconds but doesn't help you improving precision in switching chapters.