Trying to calculate "% played" for video tracks but get type error "has type float?" #3149
-
Again I’m trying to do something simple and sat half the night, to no avail: I want to calculate (and later show) the "percent played" of the current video track. This is the code so far:
What am I doing wrong? It seems |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks, that brought me further! is there a faster/better way to get a video track’s duration? Next question, if I may… The goal of all that "% played" calculation is to show an unobtrusive small bar below the text box, to let the listener know how far we have progressed in the currently playing video: I thought of using
where source Unfortunately, the "rectangle", i.e. "progress bar" never updates. I wonder what I’m missing this time. |
Beta Was this translation helpful? Give feedback.
-
Minimal example:
|
Beta Was this translation helpful? Give feedback.
-
Ha! Found it! For whatever reason, I have to use curly brackets around the part that should calculate new everytime:
Now I have to find out what the curlies actually mean in LS… |
Beta Was this translation helpful? Give feedback.
-
Hi @Moonbase59,
I think most of the sources support |
Beta Was this translation helpful? Give feedback.
-
@vitoyucepi Hi, thanks for the suggestion! I was never really happy with having to read a file from metadata just to get the duration, but didn’t know better. ;-) Using
to just
Much better, and rather happy with the result: Note to myself: The important thing here was to keep the sources separate: Source |
Beta Was this translation helpful? Give feedback.
request.duration
can returnnull
if the computation of the duration failed. You should donull.get(requestion.duration(...))
to get the value.