Using 2 countdown timers with the same count down time on two different screens!
Has anyone come across this use case that has figured a way to do this?
I thought i would ask the forum rather than spinning my wheels so to speak.
I am trying to use a countdown timer for two players in a sports game and the countdown times have to be the same. We also pause the timer for time outs etc…
Although it can be done for one player quite easily as shown by @Victor in another post for pausing a countdown timer, pausing across two players, different users is a problem…
Trying to sync the countdown times has been quite the challenge…
If anyone has any suggestions it would be greatly appreciated.
Two players on two different devices?
Can you share what you have already in an app preview?
Is it that you want to display a live countdown in the app of time remaining?
If you have bool field in collection gameIsPaused
To take further you could have a game_timings collection that logs the timestamps of the pause and unpause actions.
As with most problems there are a few ways to approach it but I would ask more info to get to the right outcome. And yes, Victor is the godfather of this kind of thing.
Yes 2 different devices thats what creates the challenging part…
Yes i want to display the time remaining of the game for both users on different devices ànd also be able to pause the timer for time outs and restart again.
Yes i have a boolean to flag the game is paused and used @Victor example to stop and start the time as @victor is yes,the godfather of tricky Adalo workarounds and his efforts are most appreciated… Shoutout for @Victor…
Different attempts that come close to working are out a number of seconds and create problems.
Could you explain more " To take further you could have a game_timings collection that logs the timestamps of the pause and unpause actions" that sounds comforting…
I’m assuming you would like to display remaining time and you know how to convert finish time-start time into seconds for countdown.
So, you have some property in some collection, where you store the end time for the game. In my example I was using Users collection (Logged-In User) and used a property there.
However in your case it’s not possible to use Users collection, as you have 2 users. So, you need to store the info about game times in some other collection.
It could be a Games collection, for instance. When you create a Game, you set start and finish times. And then you make Current Game available for all game participants (i.e. users). With this, all Users who have access to Current Game will use the same data to calculate remaining time.