Hi all,
So I’ve got quite a complex set up going on here, probably more complex than it needs to be, but I’ll attempt to explain.
At a high level, the concept is an exercise application. Hosts create a workout, add exercies (along with the duration of each exercise), and then stream the class to an audience. The countdown timer is used to display the remaining time left of the current exercise.
- I have two separate pages on my app that show a countdown timer (the ‘hosts’ view, and the ‘audiences’ view)
- These two timers should always be in sync for ALL users viewing either of those two pages (i.e. should both show the same values)
- The values to be input into these timers are generated by the user when they create a workout. There is a separate page where they enter the timer value, and it is captured in seconsd
- In order to trigger the timer to start, there is a ‘Start’ button on one of the pages that is clicked by a user
- The way this works is that I have a data field called ‘Status’; When the user clicks ‘start’, the status changes in the data base from ‘start’ (countdown timer inactive) to ‘play’ (countdown timer becomes active), and so the countdown timer begins counting down
- Since this is a change in the back end, the countdown timer should start for ALL users on BOTH pages at roughly the same time
- To ensure the timers are sync, the countdown timer will capture the current date, then add on the duration of the current exercise (for example, if the current time 12:00pm, and the current exercises goes for 5 minutes, it will set the countdown timer to countdown to 12:05pm. The reason it works this way, as opposed to a standard timer, is because I want all the timers to be synced, and linking it to a universal date/time, it should be consistent
Now, I’ve had this working successfully previously, but I spent a couple of months away from Bubble, and have come back to find there are issues.
The timer still starts as it should, but the issue is that the two timers displays different values sometimes. For example, when I press ‘start’, the timer on page A will show “10:00”, but the timer on page B will show “10:30” or something.
If I test this on two separate windows on my laptop, it works fine. However if I test the exact same thing with one desktop window and one on my mobile, the timers are out of sync.
I’m not sure why this would be happening. The only thing I can think of is there’s a syncing issue with how date/time is displayed on my desktop vs how it’s displayed on my mobile? Could the date/time on my desktop be slightly different to on my mobile? But as I said it has worked previously, so I’m not sure why this would change. I obviously want the solution to work across all devices in the same time zone, so if there is a syncing issue I’ll need to rectify it somehow.
Apologies if this doesn’t make much sense. I’m happy to clarify any details, and provide access to the app if required. Thanks in advance!