Page tree
Skip to end of metadata
Go to start of metadata

ON THIS PAGE

For more information about available methods, refer to the roSyncManager entry. To enable Genlock in JavaScript, pass the BSSyncManager/roSyncManager domain to the videooutput.SetSyncDomain() method

Object Creation

BSSyncManager(in DOMString domain, in DOMString multicast_address, in DOMString multicast_port);

Methods

void SetMaster(in boolean master_mode) raises(DOMException)

void Synchronize(in DOMString id, in unsigned long ms_delay) raises(DOMException)

void Close()

Shuts down the instance, preventing it from further consuming resources. If this method is not called, garbage collection determines when the instance will be destroyed.

HTML Video Functions

setSyncParams(in DOMString domain, in DOMString id, in DOMString iso_timestamp)

HTML video tags include the setSyncParams() function. Calling this function synchronizes the video with the specified sync group.

Events

The following event is available on the BSSyncManager object. It can receive events of the type BSSyncManagerEvent.

  • onsyncevent 

BSSyncManagerEvent – Attributes

The following attributes are relevant to the onsyncevent event:

  • readonly attribute DOMString domain
  • readonly attribute DOMString id
  • readonly attribute DOMString iso_timestamp

Example

The following JavaScript example contains two videos being synchronized locally with BSSyncManager. If a Slave player is configured to be in the same PTP domain as the Master player and uses the Slave HTML script, then it will display the videos in sync with the Master player. This can be implemented on multiple Slave players.

Master Script
<video id="one" hwz="on">
    <source id="one_src" src="pirates.mov">
</video>

<script>
    // Create the sync manager with provided multicast settings
    var sync = new BSSyncManager("domain1", "224.0.126.10", 1539);

    sync.onsyncevent = function (e) {
        document.getElementById("one").setSyncParams(e.domain, e.id, e.iso_timestamp);
        document.getElementById("one").load();
        document.getElementById("one").play();
        console.log(e.domain);
        console.log(e.id);
        console.log(e.iso_timestamp);
    };

    function startTimer() {
        setTimeout(function () {
            restartMaster()
        }, 30000);
    }
    function restartMaster() {
        // Synchronize the videos to start playing in 1000ms
        sync.SetMaster(1);
        sync.Synchronize("sync_event1", 1000);
        startTimer();
    }
    restartMaster();

</script>

 

 

Slave Script
<video id="one" hwz="on">
    <source id="one_src" src="pirates.mov">
</video>

<script>
    // Create the sync manager with provided multicast settings
    var sync = new BSSyncManager("domain1", "224.0.126.10", 1539);

    sync.onsyncevent = function (e) {
        document.getElementById("one").setSyncParams(e.domain, e.id, e.iso_timestamp);
        document.getElementById("one").load();
        document.getElementById("one").play();
        console.log(e.domain);
        console.log(e.id);
        console.log(e.iso_timestamp);
    };
 
</script>

</body>
</html>

  • No labels