general purpose timer
A while ago, I noticed that the memory game uses a timer that is tied to the library closely. It cannot be used for anything else. I decided to create something like a general purpose timer for H5P. And here it is: https://github.com/otacke/h5p-timer. You will also find it attached to this post as an h5p file. It is not a content type, so don't expect it to do anything on its own ;-)
The timer is not intended for time critical applications, but it can easily be used to keep track of time in games, to set a time limit for tasks, or to create other innovative content libraries that need triggers based on time. What about a mod-player that can handle ProTracker files for example? ;-) Also, it might reduce some redundancies across different h5p libraries under the hood.
The timer...
- can count up and down
- can use milliseconds internally but only "displays" tenths of seconds and above
- can be paused
- keeps track of three different types of counters: clock time (can be modified even if running, e.g to give a time bonus), playing time (the amount of time that the clock has been ticking), and running time (the total running time ignoring pauses)
- offers three types of notifications using callback functions for each type of counter: notification at a particular point in time, notification after a certain time period has passed, and recurring notifications in fixed intervals
- offers some static utility functions: check if something is a timecode, convert timecodes to milliseconds and vice versa, extract single time elements like days or seconds from timecode or milliseconds
It may still contain bugs, but I think that someone else should have a closer look at it. I hope that my comments are good enough to help you. Your feedback is highly appreciated!
icc
Mon, 09/19/2016 - 10:34
Permalink
Cool, seems like it would
Cool, seems like it would cover most of one's needs in a timer. Perhaps Memory Game should start using this soon!
If there's something that could have made it even greater it would be implementing the H5P.EventDispatcher, thus allowing events like start, stop, reset etc.
Great work!
otacke
Mon, 09/19/2016 - 10:45
Permalink
I'll gladly figure out how
I'll gladly figure out how the EventDispatcher works and implement it!
otacke
Mon, 09/19/2016 - 18:47
Permalink
I had a look at the H5P
I had a look at the H5P.EventDispatcher. Seems to pretty straight forward. I'll be back home from a business trip to Denmark (where they also just learned about h5p :-D) in about 3.5 hours. Maybe I'll be awake enough to squeeze it in my code today.
otacke
Mon, 09/19/2016 - 23:23
Permalink
Done. At least basic stuff
Done. At least basic stuff (play, pause, stop, reset). I'll have another look at the code in order to see if there might be something more I could do - maybe add the counter times as event data or something like that. But not before I've had some sleep. Was a looooong day :-)
thomasmars
Tue, 09/20/2016 - 08:58
Permalink
Looking good :)
Looking good :)
otacke
Tue, 09/20/2016 - 09:48
Permalink
Thanks! I'll probably write a
Thanks! I'll probably write a brief "how to" document resembling your guides, so it becomes easier for people to use it - and especially to hunt bugs.
otacke
Sat, 10/01/2016 - 13:41
Permalink
version 0.2-alpha is out
I added the Event Dispatcher as already stated above, and I ironed out some flaws. Feel free to check out v0.2-alpha of the H5P-Timer on github or using the file attached to this post. You will also find some documentation about the H5P-Timer functions that you can use in the github wiki.
If you stumble upon anything that in your opinion should be improved, please drop me a note. Especially: What would be left to do so the library might become part of the official H5P releases?
thomasmars
Tue, 10/04/2016 - 11:50
Permalink
Cool,
Looks like you have done a very good job, I haven't been able to go through it completely but it looks very comprehensive. Nice!
To become a part of the official H5P release it would have to be used by an official H5P library.
otacke
Tue, 10/04/2016 - 12:49
Permalink
I knew why I already prepared
I knew why I already prepared https://github.com/otacke/h5p-memory-game/tree/H5P-Timer this weekend as a demonstration ;-) Should I just create a pull request for the memory game linking to/mentioning the repository of H5P-Timer?
otacke
Tue, 10/04/2016 - 20:08
Permalink
Create pull request: done.
Create pull request: done.
icc
Wed, 10/05/2016 - 11:30
Permalink
Thank you! We'll have a look
Thank you! We'll have a look shortly, stay tuned :-)
julieglenn78
Mon, 09/04/2017 - 21:31
Permalink
timer with flashcard
Has anyone combined this timer to the flashcards? I haven't been able to find anything but I need one. Or if anyone is up for the task?
Riff City Guitar
Sun, 04/28/2019 - 12:51
Permalink
Timer update
This was a great idea...is the one linked the most updated version? We'd like to use a timer on almost every activity
otacke
Mon, 04/29/2019 - 04:30
Permalink
Hi Riff!The one in the
Hi Riff!
The one in the repository (https://github.com/otacke/h5p-timer) is the most recent version, yes.
Best,
Oliver
matematikvakti
Mon, 05/25/2020 - 16:33
Permalink
Timer for question set
Hi,
I use h5p on matematiktestleri.net. I create math quizzes with "question set". I want to add a timer to the quizzes. How can I do that?
otacke
Mon, 05/25/2020 - 20:22
Permalink
Hi!Coding... ;-) Sorry, there
Hi!
Coding... ;-) Sorry, there's no step-by-step guide that I can give you. The repository is there, you load the timer class in library.json, you get yourself an instance and do what you need (https://github.com/otacke/h5p-timer/wiki/API-documentation).
Best,
Oliver
lukep
Sat, 03/19/2022 - 21:36
Permalink
maybe a way to create a timer for non coders?
Hi, the function for a timer in the presentation is still a coder thing... is there a way to make it understandable for non coders? It is only a timer, a function that exist since 1994 in power point, but a funciton that is really usefull and important for a presentation.
@otacke isn't possible to make your project of 2016 more accessible?
https://www.olivertacke.de/2016/08/15/teaching-h5p-to-present-automatica...
maybe as a part of your fantastic content page?
https://www.olivertacke.de/labs/h5p-content-types/
please
Thanks
Luke
otacke
Sun, 03/20/2022 - 23:51
Permalink
I am not sure if I understand
I am not sure if I understand what you are referring to. A content type that counts up or down or shows the current time? Either way: "I can't do this all on my own, no I am no, I'm no superman ..." (Lazlo Bane)
lukep
Fri, 03/25/2022 - 21:01
Permalink
timer for slide automation
hi,
thanks for answering
your posti title was "Teaching H5P to present automatically", so my question and proposal is to make available an option for every slide to set a duration time, which would enable the possibility to have automated and also looped timed presentation.
You wrote on that post" With my contribution you can activate an auto presentation mode that will show each individual slide as long as you want to – or you simply set a global time period like 20 seconds for Pecha Kucha. You can also decide whether you want the presentation to loop indefinitely or not." Where is it then? Well, it’s not totally finished. You can already get it from github and use it, but the presentation editor still lacks the option to set a time period for a slide conveniently. Until now, you will have to edit the H5P file manually if you need individual settings. But, when that is done, you may be able to create something like this… Isn’t that nice?"
so if possible, can you reactivate this project and then add it to your h5p content page?
very much thanks
otacke
Fri, 03/25/2022 - 22:07
Permalink
Hi!I see, so you want time
Hi!
I see, so you want time-based progression of slides. My old code was lost, but my experience with H5P has increased exponentially compared to then :-D It's not complicated, but I'd still need to find the free time. Same goes for the H5P core team, because they are the maintainers of Course Presentation (and I'll not host a fork on my website) and will have to invest their time (=money) into reviewing, testing and releasing.
Not meant offensive, but most people are always quick to request all kinds of things here on the forum, but hardly wonder how much effort is put into things to fulfill their wishes and solve their problems.
Best,
Oliver
shawneebaugman
Mon, 09/09/2024 - 20:39
Permalink
Will it display the timer for the user? Or only for tracking?
HI there, thank you so much for creating this general purpose timer. I am attempting to implement. Right now I'm not sure if I have implemented it improperly or if I am misunderstanding it. When implemented properly, should the timer clock be visible to the quiz-taker? Or is it only a tracking timer to record the data? Right now I don't see a timer on the quiz itself.
I may have also tried to implement it improperly --- I tried initializing the timer and calling "play" within a fill-in-the-blanks quiz that is inside of an interactive course book --- should this work? Or is the timer only for individual quiz elements (not coursebooks or presentations)?
Thank you for your help!
shawneebaugman
Mon, 09/09/2024 - 20:44
Permalink
Will it display the timer for the user? Or only for tracking?
Sorry if my comment posts twice, but I don't see it. Thank you for creating this timer. I am unsure if I'm implementing it correctly -- should the timer be visible to the quiz-taker? Or is it only for capturing the timer data?
Also, I tried initializing the timer inside of one of my fill-in-the-blanks quizzes that is inside of an interactive coursebook -- should this be possible? Or can I only use the timer on individual quizzes (not coursebooks or slide presentations)?
Thank you again!
otacke
Mon, 09/09/2024 - 21:32
Permalink
If you are referring to H5P
If you are referring to H5P.Timer: This is merely a very old utility (that I'd not implement this way nowadays) for scheduling timers that allows to receive notifications on events and offers some convenience functions. It does not automatically add a timer to anything.
shawneebaugman
Tue, 09/10/2024 - 15:32
Permalink
Thanks! Any tips on how I may attempt creating a visible timer?
I appreciate your prompt response! And it makes sense now what the utility is. Would you have any tips for how one could go about creating a timer that is visible to the quiz-taker? I might take a crack at it myself or I may need to hire someone to create something like this in order to finish a project I need it for.
otacke
Tue, 09/10/2024 - 18:05
Permalink
There are different ways to
There are different ways to do this, depending on the exact requirements: