PlaybackSync

From opensmil
Jump to: navigation, search

PlaybackSync In Smil

When several devices that want to play the same content at the same time, PlaybackSync can support for play the sync content in the local network by ethernet connection. PlaybackSync In Smil use the Server-Client architecture, server will send the sync event to client to notify client which content shall be displayed. All the content will be displayed at the same time with the same sync group (Sync with the same host server).

smartapi:syncGroup meta element

syncGroup is a random string, to distinguish different sync group in the same net.

Example:

<smil>
<head>
<meta name="smartapi:syncGroup" content="24776663" />
</head>
</smil>

Definition

  • Host device: Send commands to client devices to trigger / control playback.
  • Client device: Receive and execute commands from host device
  • Discovery timeout: If a client device cannot discover its host (the default discovery timeout is 50 seconds), this client device will become a host deivce.

Sync Attribute

sync attribute defines a host with an IP address.

<body sync="sync://192.168.1.43">
The device with IP 192.168.1.43 is now a host device. All devices in the same local network will try to synchronize with the host device. If the host device becomes unavailable, one of the client devices will become a temporary host. When the original host is back to the network, the temporary host will switch back to a client.

sync attribute: host auto-assignment.

<body sync="#">
One of the devices in a network will be assigned as a host automatically. All devices in the same local network will try to synchronize with the host device.

PlaybackSync Example

Example: Assign a host player in the network, and have multiple players to sync playback with the host player.

<?xml version="1.0" encoding="utf-8"?>
<smil xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <head>
    <meta name="smartapi:syncGroup" content="24776663" />
    <layout>
      <root-layout xml:id="root" width="1920" height="1080"/>
      <region xml:id="ZONE1" width="640px" height="1080px"/>			  
    </layout>
  </head>
  <body sync="sync://192.168.1.43"> <!-- Set 192.168.1.43 to host device for synchronized playback                                   -->
                                    <!-- Client devices detect the host by checking the host's IP address to manage its playback     -->
                                    <!-- All devices in same network should use the same SMIL script                                 -->
    <seq>
      <img src="01.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="02.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="03.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="04.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="05.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="06.jpg" region="ZONE1" fit="fill" dur="8s"/>
    </seq>
  </body>
</smil>


Example: Generate host player automatically, and have multiple players to sync playback with the host player.

<?xml version="1.0" encoding="utf-8"?>
<smil xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <head>
    <meta name="smartapi:syncGroup" content="24776663" />
    <layout>
      <root-layout xml:id="root" width="1920" height="1080"/>
      <region xml:id="ZONE1" width="640px" height="1080px"/>			  
    </layout>
  </head>
  <body sync="#"> <!-- Select host device automatically for synchronized playback                              -->
                  <!-- Client devices detect the host by checking the host's IP address to manage its playback -->
                  <!-- All players in same network should use the same SMIL script                             -->
    <seq>
      <img src="01.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="02.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="03.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="04.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="05.jpg" region="ZONE1" fit="fill" dur="8s"/>
      <img src="06.jpg" region="ZONE1" fit="fill" dur="8s"/>
    </seq>
  </body>
</smil>

Handle Host Server Conflict

If more than one device is in host mode, one of devices will switch to client mode according to following priority: Priority 1. Host server IP address is equal to "sync" attribute. Priority 2. Last number of IP address. Bigger number will lose host. If host server IP is equal to sync attribute, other server devices shall switch to client mode. If no one is equal to sync attribute IP address, it will compare with last number of IP address, bigger number will switch to client. For example: If two device is running on host mode:

A: 192.168.1.153

B: 192.168.1.69

Compare with last number of IP address (153, 69), B will keep in host mode, A will switch to client and restart to play Smil.

Related