Advertisement
Guest User

EMT-Sync

a guest
Jun 20th, 2016
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Sync : MonoBehaviour {
  5.  
  6.     public TBE.TBSpatDecoder Decoder;
  7.     MediaPlayerCtrl Ctrl;
  8.  
  9.     void Start ()
  10.     {
  11.         Ctrl = GetComponent<MediaPlayerCtrl> ();
  12.         Ctrl.OnReady += OnReady;
  13.  
  14.         Decoder = GetComponent<TBE.TBSpatDecoder> ();
  15.         Decoder.syncMode = TBE.TBSyncMode.TB_SYNC_EXTERNAL;
  16.     }
  17.  
  18.     void Update ()
  19.     {
  20.         if (Ctrl.GetCurrentState () == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
  21.         {
  22.             float ms = Ctrl.GetSeekPosition ();
  23.             Decoder.setExternalClockInMs (ms);
  24.         }
  25.     }
  26.  
  27.     void OnReady()
  28.     {
  29.         Ctrl.Play ();
  30.         Decoder.play ();
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement