Unity 3D Plugin >
Augmented Video

Using the previous tutorial as a base, we are now going to add an augmented video to our app.

Open your Unity3D project and import our SDK.
In order to create a video marker you will need both the MarkerObject prefab and the VideoObject prefab. 
Begin by placing the MarkerObject prefab in the scene hierarchy then add the VideoObject as one of his children. You can alternatively use the MarkerVideo prefab .

Let’s take a look at the elements that compose the VideoObject:

  • Video Player script: this is the video playback main controller. From the inspector you can set the video source (either a video clip in the app assets or a URL).
    From this script you can also set the Loop function if you want the video to restart every time it reaches the end or the Play on Awake feature to start the video as soon as the marker is seen by the camera.
  • VideoPlane: this is the element on which the video will be displayed. You can change the scale and position to match the desired effect.
  • PlayButton: this is a graphical representation for the play button as well as for the loading icon and the error icon. You can find these sprites in the PikkartAR/Resources folder. If you want to change the behavior or look of the interface you can do so by modifying the VideoCtrl script.

If you don’t have a video ready you can use the SampleVideo.mp4 provided within our Samples package. emember to correctly set the Touch Input Mask parameter on the PikkartARCamera object to the same layer of the Video Object (usually Default) to correctly enable touch controls on the video.

Now that you are all set you can try the application on both the editor or on your device

.

On device, by tapping the video object on the touchscreen, you can start, pause and resume the video playback. You can do the same thing in the editor by clicking the object in the GameView on PlayMode. Just be sure that the camera element is watching your marker. You can verify that on the camera preview window