Player APIs (BrightScript & Ja...
JavaScript APIs

syncmanager

7min
as of brightsignos 8 2 10, the syncmanager object provides synchronization capabilities for video walls and other deployments that require closely calibrated interaction among players syncmanager idl \[ constructor(string networkinterface, string domain, string multicast address, unsigned multicast port) ] interface syncmanager { attribute boolean leader; attribute string networkinterface; readonly attribute string domain; attribute boolean encrypted; attribute boolean encryptionkeyisobfuscated; writeonly attribute string encryptionkey; void synchronize(in string id, in unsigned long ms delay); void close() }; object creation to create an syncmanager object, first load the brightsign/syncmanager module using the require() method const bssyncmanager = require("@brightsign/syncmanager"); let sm = new bssyncmanager(network interface, domain, multicast address, multicast port); the constructor for a sync manager object takes four arguments network interface string string the network interface (for example, "eth0") domain string string the domain identifier used to distinguish among different rosyncmanager instances multicast address string string the multicast address to which synchronization messages are communicated multicast port int int the multicast port to which synchronization messages are communicated syncmanager synchronize() void synchronize(in string id, in unsigned long ms delay) broadcasts a time stamped message to other players this method is used on the leader unit only the message will be rebroadcasted every second to allow follower units that are powered on late to catch up the network message contains the sync id, as well as the domain and a timestamp the timestamp is created at the point when this method is called; however, it can be offset by passing a non zero ms delay value, allowing synchronization points to be set slightly in the future and giving the client enough time to switch video files and perform other actions the identifier parameter allows the script on the leader unit to pass a filename, or some other useful marker, to the follower units as part of the synchronization message this method returns the message that is sent out so that the leader can access the timestamp the synchronization message is sent over all available networks (including wifi), but follower units will use only the first message received because synchronization can involve follower units seeking to catch up with the playback of a leader unit, we recommend using the more efficient mov/mp4 container format when synchronizing video files transport stream files (mpeg ts) are also supported, but they must begin with a presentation timestamp (pts) of 0 program stream files (mpeg ps) are not supported close() void close() shuts down the instance, freeing the underlying sync manager syncmanager properties leader boolean boolean a read/write attribute to set/get whether the sync manager is a leader, or a follower networkinterface string string a read/write string attribute to set/get which network interface the sync manager uses (for example, " eth0 ", " wifi0 ") the networkinterface parameter can be "" to allow any network interface domain boolean boolean a read only string attribute which returns the domain for the sync manager encrypted , encryptionkey and encryptionkeyisobfuscated are used to configure the use of encryption with the sync manager encrypted boolean boolean a read/write attribute that controls whether the sync manager uses encryption if true , encryption is enabled on the unit encryptionkeyisobfuscated boolean boolean a write only string attribute which is used to set the key used for encryption contact support\@brightsign biz mailto\ support\@brightsign biz to learn more about generating a key for obfuscation and storing it on the player encryptionkey string string a write only string attribute which is used to set the key used for encryption example this html code lets you listen for sync messages using syncmanager \<!doctype html> \<html> \<head> \<script> function runtest() { var smc = require('@brightsign/syncmanager'); var sync = new smc("", "brightsign", "224 0 126 10", 5439); sync leader = false; sync encrypted = false; sync addeventlistener('syncevent', function f(e) { console log("node style event " + json stringify(e) + e domain + "," + e id + "," + e iso timestamp); }); } \</script> \>/head>> \<body bgcolor="#e6e6fa" onload="runtest()"> \<h1>syncmanager test page\</h1> \</body> \</html>