Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Sync : MonoBehaviour {
- public TBE.TBSpatDecoder Decoder;
- MediaPlayerCtrl Ctrl;
- void Start ()
- {
- Ctrl = GetComponent<MediaPlayerCtrl> ();
- Ctrl.OnReady += OnReady;
- Decoder = GetComponent<TBE.TBSpatDecoder> ();
- Decoder.syncMode = TBE.TBSyncMode.TB_SYNC_EXTERNAL;
- }
- void Update ()
- {
- if (Ctrl.GetCurrentState () == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
- {
- float ms = Ctrl.GetSeekPosition ();
- Decoder.setExternalClockInMs (ms);
- }
- }
- void OnReady()
- {
- Ctrl.Play ();
- Decoder.play ();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement