• home
  • HoloStream Unity Player

HoloStream Unity Player

The HoloStream Unity Player is a c# script to download and stream adaptive HoloStream clips directly into a Unity Scene. The HoloStream Unity Player Unity version 2018.4(LTS).

Overview

HoloStream Player Install

The HoloStream Unity Player is included with the Unity OMS Player Package, included in your HoloSuite install. With your Unity project open, you can select Import Package > Custom Package and import the OMS Player 2021.2.unitypackage located in your HoloSuite 2021.2 install directory, and import all assets when prompted.

The Holo Stream Player script

../_images/HSP.png

The Holo Stream Player script can be applied to any GameObject and configured to turn that object into a HoloStream player.

The Holo Stream Player contains the following inspector setttings:

Input Data

  • Mpd URL: Supply the .mpd url for your streaming clip to this parameter. This clip will be loaded and begin streaming when your unity scene is played.

Configuration

  • Material: Set the Material for use in the OMS Player. For proper playback, select an oms player material, like SkinnedMeshMaterial or SkinnedSurfaceMaterial. The _MainTex Property will be overwritten with the current streaming texture.

  • Loop: Enable looping playback. If disabled, the clip will freeze after completing playback.

Logging

  • Verbose Logging: Enable console logging for streaming video playback.

Experimental

  • Audio Support: Play any embedded audio in the streaming clip.

Advanced

  • Platform Settings: Supply a Platform Settings scriptable object to specify platform settings.

  • Buffer Ahead: Set the number of seconds of HoloStream data that can be downloaded ahead of the current time. Must be a positive number.

  • Headphones Resume: Resume playback if headphones are re-attatched to the device on iOS builds.

HoloStream Platform Settings

../_images/ScriptableObject.png

The HoloStream Platform Settings scriptable object is used to override default quality settings for streaming playback. You can create a HoloStream Platform Settings object by right clicking on the project view and choosing Create -> Arcturus -> HoloStream -> Platform Settings.

The Platforms Settings parameter is an array of invidiual settings. Increase the size to expose one or more platform settings elements. Each element has the following parameters:

  • Use As Default Settings: HoloStream will fall back on the Default Settings if no setting with a Platform matching the platform playing the current build is found. We recommend you only mark a single entry as the default settings.

  • Platform: Choose an supported Unity platform for these platform settings. These settings will be loaded when your HoloStream Unity project is played from a matching device. We recommend only one entry per platform.

  • Player Buffer Count: Set the number of players for buffering HoloStream. The HoloStream player uses this number of players to load multiple chunks in advance for smoother playback. Not recommended to change from the default value.

  • Maximum Adaptive Resolution: Set the maximum texture resolution threshold for streaming. Higher resolution profiles will not be requested from the streaming server, even when there is sufficient bandwidth.

  • Video Cache Texture Resolution: Set the texture resolution used when video frames are cached after download from the streaming server. Larger values may use more memory when playing a streaming clip.

  • Video Cache Texture Format: Set the unity Texture Format (external link) used for cached frames.

  • Playback Speed: Set the playback speed for streaming video. Note that poses will not be interpolated between mesh frames.

The first settings element matching your current platform will be used during HoloStream playback. If no match is found, the last element with “Use As Default Settings” enabled will be used.

Scripting

Use the following functions on your HoloStream Player component to programmatically drive streaming playback.

public void LoadURI(string URI)

Load the .mpd url URI. Clips auto-play when loaded.

public void Play()

Play the currently supplied streaming clip.

public void Stop()

Stop playing the current streaming clip.

public void Seek(float targetTime)

Seek the specified targetTime in seconds.

Custom Events

Events

The following unity events are exposed to interface with HoloStream Playback

UnityEvent OnNewClipLoadStart

Invoked immediately when a new clip is loaded via LoadURI()

ClipLoadedEvent onClipLoaded

Invoked in the following Update whenever a new clip is loaded via LoadURI().

ClipLoadedEvent is a UnityEvent<float>. The event returns the total duration of the streaming clip.

PlayStateChangeEvent onPlayStateChange

Invoked whenever the the HoloStream clip starts or stops playing due to LoadURI(), Play(), Stop(), or when playback is paused for buffering.

PlayStateChangeEvent is a UnityEvent<OMSPlayer.State>. The event returns either the OMSPlayer.State.Play or OMSPlayer.State.Pause state.

PlaytimeChangeEvent onPlaytimeChanged

Invoked whenever the current time in the clip changes. This happens every update during uninterrupted playback, and during seeking.

PlaytimeChangeEvent is a UnityEvent<float>. The event returns the new current Time.

PlaybackEndedEvent onPlaybackEnded

Invoked whenever the end of the clip is reached if looping is disabled.

PlaybackEndedEvent is a UnityEvent.

BufferTimeChangeEvent onBufferTimeChanged

Invoked whenever the buffered time reported from the streaming server changes, or when seeking.

BufferTimeChangeEvent is a UnityEvent<float>. The event returns the new current Time.

NetworkStatusEvent onNetworkStatusChanged

Invoked whenever a connection error is reported, or whenever a clip becomes ready for playback or starts buffering.

NetworkStatusEvent is a UnityEvent<StreamRequestWorker.State>. StreamRequestWorker.State is an enum with the following possible values: ready, buffering, connectionerror.