vimeo / vimeo-unity-sdk

Easily stream your Vimeo videos into Unity or record and publish out to Vimeo.
MIT License
211 stars 49 forks source link
360 360-video ar capture-video recording unity video vimeo vr

Vimeo Unity SDK

This plugin has two major features:

Installation

Download the most recent .unitypackage from the latest releases and open it up.

Recording

Features

The Vimeo Recorder is built on top of Unity's native MediaEncoder to make it simple to capture your Unity scene and share to Vimeo. Features include:

Requirements

Getting started

1. Setup

We provide a simple demo scene in the Vimeo/Scenes folder called Recorder. The Recorder scene contains the prefab, [VimeoRecorder]. Select it and in the component inspector you'll see the recording settings.

In order to add the Vimeo recorder in your own Unity scene simply go to the menu, GameObject > Video > Vimeo Recorder. You can also right-click in your Game Hierarchy and go to Video > Vimeo Recorder.

Sign into your Vimeo account by clicking Get Token. After you authorize Unity with Vimeo, copy the token, paste it into the Vimeo Token field, and click Sign into Vimeo.

2. Recording

Once you're signed in, all you have to do is click the Start Recording button. When you're done recording, click Finish & Upload.

Control recording via a script

Probably the most powerful part about this plugin is that you can control recording via a script. Below is a simple code snippet on how you would do that.

using UnityEngine;
using Vimeo.Recorder;

public class CustomRecorder : MonoBehaviour {
  VimeoRecorder recorder;

  void Start() {
    recorder = gameObject.GetComponent<VimeoRecorder>();
    recorder.defaultVideoInput = Vimeo.Recorder.VideoInputType.Camera;      
    recorder.defaultResolution = Vimeo.Recorder.Resolution.x2160p_4K;
    recorder.defaultAspectRatio = Vimeo.Recorder.AspectRatio.x16_9;
    recorder.frameRate = 60;
    recorder.recordMode = Vimeo.Recorder.RecordMode.Duration;
    recorder.recordDuration = 5; // in seconds
    recorder.autoUpload = true;

    recorder.videoName = "My Custom Video";
    recorder.privacyMode = Vimeo.Services.VimeoApi.PrivacyModeDisplay.HideThisFromVimeo;
    recorder.autoPostToChannel = false; 

    recorder.OnUploadComplete += UploadComplete;

    recorder.BeginRecording();
  }

  void UploadComplete() 
  {
    Debug.Log("Uploaded to Vimeo!");
    // Now you could change the scene and then immediately queue up another recording.
    // ...
    // recorder.BeginRecording();
  }
}

In this sample, CustomRecorder is assuming that it is a part of the same GameObject as the VimeoRecorder. All the settings that are avaiable in the editor GUI can be controlled via code.

Streaming

The SDK comes with the following example Unity scenes in the Vimeo/Scenes folder. Please note these demos don't work out of the box. You will need to authorize your Vimeo account and select your own video test.


Player - Demos simple video streaming inside of a 3D environment.

360Player - Demos how to stream 360 videos from Vimeo (supports 3D / stereoscopic video).

CanvasPlayer - Demos how to build a canvas-based player with basic playback controls.

Streaming Features

Streaming Requirements

Setting up

1. Choose your playback method

Open up your Unity scene or create a new one. For streaming any Vimeo video, you will be using the VimeoPlayer component. There are two ways to setup the Vimeo player in Unity:

Prefab setup

The easiest way to get started is to either drag in one of the prefabs from Vimeo/Resources/Prefabs or simply right-click on your scene and the Vimeo Player from the Video menu:

Manual setup

If you are setting up your own scene and want to specify your video "screen" and audio outputs, you can add the Vimeo Player component to your GameObject.

2. Sign into your Vimeo account

Sign into your Vimeo account (or create one if you haven't already) and make sure you have some videos uploaded.

Vimeo & AVPro

If you're looking for an even more robust streaming and/or recording solution, we have integrated into AVPro's Video and Movie Capture plugins.

After installing either of AVPro's tools, the Vimeo plugin will automatically detect AVPro and a new option will appear.

Streaming with AVPro Video and Vimeo

The Vimeo Player component will now show a Video Player dropdown letting you to switch between Unity's native video player and AVPro Video. After selecting AVPro, you will need to assign their Media Player to the Vimeo Player component. Now when you run Unity, the Vimeo Player will automatically set the URL in the Media Player.

Recording with AVPro Movie Capture and Vimeo

The Vimeo Recorder component will now show a Video Encoder dropdown letting yo uswitch between Unity's native Media Encoder and AVPro Movie Capture. Select AVPro Movie Capture and assign the Capture component. Now when you record with AVPro's tools, Vimeo will automatically upload the video after it is finished recording.

Questions, help, and support

For questions and support, ask on StackOverflow. If you found a bug, please file a GitHub issue.

Make pull requests, file bug reports, and make feature requests via a GitHub issue.

Thanks

Big thanks to the Unity teams building MediaEncoder, GenericFrameRecorder, SkyboxPanoramicShader, and DepthKit