Set Sync Delay
<void> setDelay(<Integer> delay, [<Boolean> force = false]);
<void> setDelay(<LViS.Event> event, <Integer> timecode, [<Boolean> force = false]);
<void> setDelay(<Date> time, [<Boolean> force = false]);
Sets user delay to all incoming messages.
The second form takes LViS Event and current timecode of the accompanying video/audio/content stream. It assumes that the 00 stream timecode matches the start of the LViS Event and calculates the delay so that the user receives content if they were at timecode within the LViS Event.
The third form automatically calculates the delay as
now - time
and can be used if time
is not the same as LViS Event start time.If
force
flag is true
current event will be reset even if new delay is the same as previously set delay. If force
is false
then this method does nothing in case new delay is the same as previous.Resetting an event will lead to
LViS.Event.ON_NOT_READY
, LViS.Event.ON_READY
and LViS.Event.ON_ELEMENT_REVOKE
(if any elements were published) JavaScript events to be triggered.let delay = 10;
let event = LViS.getEvent();
// fired once event has been updated
event.bind(LViS.Event.ON_UPDATE, () => {});
// teardown rendered `element` from UI
event.bind(LViS.Event.ON_ELEMENT_REVOKE, (element) => {});
// element with the correct state according to set delay is published
event.bind(LViS.Event.ON_ELEMENT_PUBLISH, (element) => {});
LViS.Sync.setDelay(delay);
Last modified 3yr ago