vendredi 1 juillet 2016

Get time values with a slider/scale


I'm coding a video player with controls that allow the user to select beginning and end time to crop/trim it. At run-time, I read the total length of the media file.

I have a "play" HScale, that updates while playing, and allow the user to seek, this is fine.

But I need two others: Beginning, and end. Let's suppose the media file is 00:02:42 long (that would be 162 in decimal) so I'd like to setup a GTK.HScale() (this is a generic, almost purely math logic - at which I'm pretty bad - question, the environment is not so important) that goes from 00:00:00 to 00:02:42.

Then, when the user moves the "beginning/start" slider (in increments of one second) and click a button, I would then retrieve the value (either hh:mm:ss, or decimal and then convert back to hh:mm:ss, no problem.) of the slider along the timeline.

My full code is here, I'm stuck in the docs, thank you for helping!


Aucun commentaire:

Enregistrer un commentaire