4 ms·
Wouldn't you still have to poll to check if the "leader" still exists?
by Retr0spectrum 11y ago
Wouldn't you still have to poll to check if the "leader" still exists?
- nathan-muir 11y agoIf playing the sound isn't latency sensitive, you could just have each tab pick a random delay [1]. When the tabs receive the event, they each wait X milliseconds. The first timer to expire marks the event as "played". Other tabs receive this event, and abort their timers. If a "leader" disappears, it will simply fall to a tab with a larger delay. [1] Something like, rounded to 50ms increments, in a range, 100 - 1000ms. Avoiding collisions / ensuring uniqueness is left as an exercise for the reader.