Get video length (Interactive Videos)
Submitted by ymdahi on Sat, 04/14/2018 - 04:38
I'm wondering if there is a way to pull the length of the video for interactive videos (specifically youtube video in my case).
I'm hoping to do this with the hooks already available, i.e. without having to get youtube api key. Is there a mechanism in h5p to get the current h5p node's video duration?
Thanks in advance.
Get video duration from h5p interactive video instance
0Supporter votes Members of the Supporter Network can vote for feature requests. When the supporter network has generated sufficient funding for the top voted feature request it will normally be implemented and released. More about the H5P Supporter Network
Wed, 04/18/2018 - 09:00
There is indeed, if you look
There is indeed, if you look at the code on github you'll find that the getDuration() function is exported, which allows you to call it.
When inside the H5P iFrame you can call it using the following code:
Wed, 05/02/2018 - 16:15
Hi Thomas, Thanks for
Hi Thomas, Thanks for pointing that out, that's very useful. My next goal is to store this value on save/update. Any recommendations on how to approach that would be appreciated. I'll share my solution at the end.
Thu, 05/03/2018 - 08:26
Hi, there's currently no API
Hi, there's currently no API for hooking into the save/update functions of H5P content, and you would not have access to the H5P instance there either way. Depending on what you want to accomplish there may be other ways to achieve what you want.
Tue, 05/08/2018 - 17:20
What I'm hoping to do is
What I'm hoping to do is display the length of the video in a view. For example, if the view is display a grid of videos, I would like to also display the length of each video - I've attached a screenshot from a site that demonstrates this visually.
Additionally, it would be ideal if the length of videos in a series can be added together (i.e. Series X with 10 videos is 20 hours long).
Any guidance on how to do this efficiently would be helpful.
Tue, 05/15/2018 - 14:05
This is beyond the scope of
This is beyond the scope of H5P. You'll have to write some code to interact with your db to retrieve the lengths of the videos and then display them on in your view.