Syncplay API Usage

This document describes new usages of Samsung Product Syncplay API for Tizen 6.5 and higher, and differences with SSSP B2BSyncplay API.


Related Info


Generals

  • Privilege: http://developer.samsung.com/privilege/syncplay
  • Privilege level: Partner

API Usages

webapis.syncplay.getVersion

This interface provides methods to get Syncplay module's version.

  • SSSP API sample code:

    var Version = null; 
    
    try {
      Version = b2bapis.b2bsyncplay.getVersion(); 
    } catch (e) {
      console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    if (null !== Version) {
      console.log("[getVersion] call syncFunction type: " + Version); 
    }
    
  • Samsung Product API sample code:

    var Version = null; 
    
    try {
      Version = webapis.syncplay.getVersion(); 
    } catch (e) {
      console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    if (null !== Version) {
      console.log("[getVersion] call syncFunction type: " + Version); 
    }
    

webapis.syncplay.createPlaylist

Make play list with video, image content to syncplay.

  • SSSP API sample code:

    var PackageId = tizen.application.getCurrentApplication().appInfo.packageId;
    var sharedDir = tizen.application.getAppSharedURI(PackageId);
    var path = sharedDir + "../res/wgt/videos/";
    var playlist = ["red.mp4", "yellow.mp4"];
    var playduration = [5, 5];
    var onSuccess = function (){
      console.log("[makeSyncPlayList] call success"); 
      };
    var onError = function (e){
      console.log("[makeSyncPlayList] call asyncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
      };
    var syncPlayContents = [];
    
    for (var i=0 ; i<playlist.length ; i++ ) {
      syncPlayContents[i] = {
        path : path + playlist[i], duration : playduration[i]}
    }
    
    b2bapis.b2bsyncplay.makeSyncPlayList(syncPlayContents,onSuccess,onError);
    
  • Samsung Product API sample code:

    var PackageId = tizen.application.getCurrentApplication().appInfo.packageId;
    var sharedDir = tizen.application.getAppSharedURI(PackageId);
    var path = sharedDir + "../res/wgt/videos/";
    var playlist = ["red.mp4", "yellow.mp4"];
    var playduration = [5, 5];
    var onsuccess = function (val) {
      console.log("[createPlaylist] call success : " + val); 
      };
    var onerror = function (e){
      console.log("[createPlaylist] code :" + e.code + " error name: " + e.name + "  message " + e.message); 
      };
    var syncPlayContents = [];
    
    for (var i=0 ; i<playlist.length ; i++ ) {
      syncPlayContents[i] = {
        path : path + playlist[i], duration : playduration[i] };
    } 
    
    try {
      webapis.syncplay.createPlaylist(syncPlayContents, onsuccess, onerror); 
    } catch (e) {
      console.log("[createPlaylist] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    

webapis.syncplay.removePlaylist

Reset the playlist, which was played via sync play.

  • SSSP API sample code:

    var onSuccess = function(val) {
      console.log("[clearSyncPlayList] success : " + val.result); 
      };
    var onError = function(error) {
      console.log("[clearSyncPlayList] code :" + error.code + " error name: " + error.name + " message " + error.message);
      };
    
    console.log("[clearSyncPlayList]");
    b2bapis.b2bsyncplay.clearSyncPlayList(onSuccess, onError);
    
  • Samsung Product API sample code:

    var onsuccess = function(val) {
      console.log("[removePlaylist] success : " + val.result); 
      };
    var onerror = function(error) {
      console.log("[removePlaylist] code :" + error.code + " error name: " + error.name + "  message " + error.message);
      }; 
    
    try {
      webapis.syncplay.removePlaylist(onsuccess, onerror); 
    } catch (e) {
      console.log("[removePlaylist] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    

webapis.syncplay.start

This interface provides methods to start sync play.

  • SSSP API sample code:

    var onChange = function(data) {
      console.log("[startSyncPlay]data:" + data + "changed");
      };
    
    try {
      console.log("[startSyncPlay] b2bsync object : "+b2bsync);
      b2bapis.b2bsyncplay.startSyncPlay(0,0,960,540,5,"OFF",onChange); 
    } catch (e) {
      console.log("[startSyncPlay] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    
  • Samsung Product API sample code:

    var syncinfo = {
      "rectX"     : 0, 
      "rectY"     : 0, 
      "rectWidth" : 960, 
      "rectHeight": 540, 
      "groupID"   : 55, "rotate"    : "OFF"
      };
    var onlistener = function(data) {
      console.log("[start]data:" + data + "changed");
      };
    
    try {
      webapis.syncplay.start(syncinfo,onlistener); 
    } catch (e) {
      console.log("[start] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    

webapis.syncplay.stop

This interface provides methods to stop sync play.

  • SSSP API sample code:

    var onChange = function(data) {
      console.log("[stopSyncPlay]data:" + data + "changed"); 
      };
    
    try {
      b2bapis.b2bsyncplay.stopSyncPlay(onChange); 
    } catch (e) {
      console.log("[stopSyncPlay] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }
    
  • Samsung Product API sample code:

    var onlistener = function(data) {
      console.log("[stop]data:" + data + "changed"); 
      };
    
    try {
      webapis.syncplay.stop(onlistener);
    } catch (e) {
      console.log("[stop] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
    }