Loading...

2017.

Welcome to VOID AR

VOID AR is devoted to the continuous development of new AR technology in order to fulfill the AR developers with ultimate imaginaries, creativities and more high quality AR contents.
You can learn to use our products from here if you are trying VOID AR for the first time.

SDK APIs

VOID AR SDK API provide three methods:

first method: call the API directly, e.g.:

    VoidAR.GetInstance().startMarkerlessTracking();

second method: override base class methods or implement interface, e.g.:

     protected override IMarker SetCloudVideoComponent(GameObject markerTarget, GameObject videoPlayTarget, string markerName, string videoPath){
     ... 
     }

third methed: VoidAREvent mechanism, e.g.:

    AddEventListener(VoidAREvent.FIND, OnFind);


VoidAREvent properties are as follows:

name: event name.

currentTarget: event target, you can get target object for event dispatch.

data: event data, e.g.: when cloud resources are loading, data indicates loading process.

 

The main functional interfaces for VoidAR SDK are as follows:


1. Local Recognization

- recognize and lose interface:

  The script component ImageTargetBehaviour provides the event dispatch mechanism on the ImageTarget object.

      void Awake() {
          //event listener
          AddEventListener(VoidAREvent.FIND, OnFind);
          AddEventListener(VoidAREvent.LOST, OnLost);
      }
      //do Find event
      void OnFind(VoidAREvent evt){
          Debug.Log("OnFind");
      }
      //do Lost event
      void OnLost(VoidAREvent evt){
          Debug.Log("OnLost");
      }

  Dispatch FIND event when target recognition is successful, and dispatch LOST event when target is lost.


2. Cloud Recognization

  Cloud recognition requires adding CloudController script components to the ARCamera, CloudController provides cloud recognition status, Cloud resources download, cloud custom data processing interfaces.

- Cloud recognization success response: means the cloud server has recognize the target successfully and returns the result.

        /// <summary>
        /// cloud recognization success response
        /// </summary>
        /// <param name="url">resource URL</param>
        /// <param name="name">resource name</param>
        /// <param name="metadata">extend data</param>
        protected override void OnSuccess(string url, string name, string metadata)
        {
            //The defaul AB model Assetsbundle is using WWW to load, and cloud video recognition create the video player
            base.OnSuccess(url, name, metadata);
            Debug.Log("OnSuccess metadata:" + metadata);
        }

  Custom data added to the cloud platform is acquired by this method.
- Set cloud video component: you can expand the player and handling play event when cloud video playing.

          /// <summary>
          /// set cloud video component
          /// You can set the extended ImageTargetBehaviour and VideoPlayBehaviour (using the Unity5.6 native player)
          /// </summary>
          /// <param name="markerTarget">marker target object</param>
          /// <param name="videoPlayTarget">video player object</param>
          /// <param name="markerName">marker image</param>
          /// <param name="videoPath">cloud video path</param>
          /// <returns>IMarker interface object</returns>
          protected override IMarker SetCloudVideoComponent(GameObject markerTarget, GameObject videoPlayTarget, string markerName, string videoPath)
          {
              var itb = markerTarget.AddComponent<ImageTargetBase>();
              itb.AddEventListener(VoidAREvent.FIND, OnFind);
              itb.AddEventListener(VoidAREvent.LOST, OnFind);
              itb.SetPath(markerName);
              var vpb = videoPlayTarget.AddComponent<VideoPlayBehaviour>();
              vpb.path = videoPath;
              return itb;
          }

- Message class event:

        //Cloud recognition targets are created locally (start tracking)
        AddEventListener(VoidAREvent.COMPLETE, OnComplete);
        //AB resource download progress
        AddEventListener(VoidAREvent.PROGRESS, OnDownload);
        //Exception notification
        AddEventListener(VoidAREvent.ERROR, OnError);


3. Void SLAM

- Start and stop interfaces: you need to add the ITricking interface to the GameObject of tracking, the implementation of ITricking in SDK is MarkerlessTracking in default. ITricking API is used for getting the SLAM status, including abnormal status.

       public interface ITricking
       {
          bool GetActive();
          int GetTrackingState();
          //Track active status
          void SetActive(bool value);
          //Tracking feedback(According to stateCode to judge SLAM status,see MarkerlessTracking for details)
          void UpdateTracking(int stateCode);
       }

  SLAM exception status code:
  1099:network error;
  501:developer account is abnormal, account is not filled or account data is incorrect;
  101:account use exceed the uselimit
  
   SLAM using interfaces :

      //start tracking
      VoidAR.GetInstance().startMarkerlessTracking();
      //stop tracking
      VoidAR.GetInstance().resetMarkerless();


4. Other

- Record screen interface: In runtime, to record the AR scene into MP4 file, and save it to your photo album. Yoou need add VideoRecordBehaviour script to ARCamera.
  VideoRecordBehaviour script offers the switcher of recording function with easy built-in GUI.
  Enable GUI: Whether to open built-in GUI. If you do not open, you need to call REC to start or stop recording:

      //Call it first time for starting recording
      //Call it again for stopping recording
      public void REC(){
        ...
      }

  The recorded video file from Android will be stored in memory card with directory DCIM folder, and The recorded video file from iOS will be stored in photo album.

- Video play interface: VoidVideoPlayer script is for video playback.

  In the video play process, the following interface can obtain video play status:

     //When the video resource is ready
     AddEventListener(VoidAREvent.READY, OnReady);
     //When the video play is end
     AddEventListener(VoidAREvent.END, OnEnd);

  VideoPlayBehaviour script is for AR video playback controller, it is used with ImageTargetBehaviour script together. When the ImageTargetBehaviour assign FIND event and LOST event, ImageTargetBehaviour will call VideoPlayBehaviour automatically.

  FIND event: Run VideoPlay() automatically. When the video is playing, it will call VideoPlay(0) to replay from beginning of the video each time the recognition is made;

  LOST event: Automatically execute VideoPause (), pause video play.