Skip to content

Examples

Merlin edited this page Jun 12, 2021 · 1 revision

Examples

USharpVideo includes some example scripts and prefabs that provide examples of how to augment the functionality of the player for use cases that aren't as common. All of these examples can be found in the USharpVideo/Examples/Prefabs directory

Reload Button

The reload button prefab has the same functionality as the reload button that is included on the video player's default UI. The reload button reloads the current video locally, this can be used to help resolve errors due to network issues, video player issues, blocked URLs, etc. This is just an example of how you can separate the button from the UI and script the reload if you do not want to show the rest of the UI.

Usage

Drag the prefab into the scene and set the target video player on the ReloadButton script to the video player to affect.

Resync Button

A more traditional 'lite' sync that will seek the video to the current time and hopefully fix audio desync.

Usage

Drag prefab into scene and set the video player on the ResyncButton script.

Sync Delay Control

This prefab is targeted at situations where you have one person broadcasting their actions in time to the video to other players. The primary common use case for this that the prefab was intended for is for karaoke where one person is singing. It includes a slider that will delay the video by a certain amount of time locally. The person singing should set their slider to 0ms, people listening should set theirs to what is required to get the singer's voice matched up. Generally voice has a latency of 200-400ms so start there.

Usage

Drag prefab into scene and set the video player on the SyncDelayManager script.

URL Button

A basic button that when clicked will play a URL. Shows how you can handle ownership locking efficiently with the video player callbacks by disabling the button interact.

Usage

Drag prefab into scene, set the target video player, and set the URL that you want the button to play. Then change the text on the VideoName text object on the button.

Volume Slider

A volume slider that is independent from the default video player UI and handles syncing the values of all copies of volume sliders locally.

Usage

Drag prefab into scene and set the target video player on the VideoControlHandler script.

Clone this wiki locally