Unity Video - AVPro video plugin


In Unity
Window->Asset Store

Type AVPro Video (Windows) in the search bar, Select the one that is $150 
Pay and download

The AVProVideo
folder and the Plugins folder need to be in your Unity project Assets folder.
You can copy these between projects.

Create a SteamingAssets folder in your Assets folder. Put your movies here.

Basic Scene Setup for a video player on a 3D object, no lighting
Switch out of the Asset Store to the main Scene tab

Delete the default Directional Light in the Hierarchy tab

Select the Main Camera
     Notice the Main Camera's default Position
is 0, 1, -10   x,y,z
     Clear Flags change Skybox to Solid Color
     Change the Background color to Black
    Uncheck Occlusion Culling
     Uncheck Allow HDR
     Uncheck Allow MSAA
     Uncheck Audio Listener

Choose Edit->Project Settings->Quality
     Trash all the Levels except Low  (Video does not need high)
     All the other defaults for Low should be good.

Choose Window->Lighting->Settings
   Skybox Material, Select the unity_dot button and choose None
    Environmental Lighting, select Source Color
    Change the Ambient Color to black
Environmental Reflections change Source to Custom
    Mixed Lighting, uncheck Baked Global Illumination

Add a Media Player Object to your Hierarchy tab
Select GameObject->AVpro->Media Player
     Click Browse to add your movie (located in your StreamingAssets folder)
     Select Playback   Loop
     Select the Platform Specific button
          Select Windows
               Select Preferred Video API  choose Direct Show

Add a 3D Object
Choose GameObject->3D Object Quad
     Position the Quad at   0, 1, -9.134    x,y,z
     Scale X to match your aspect ratio, ie 1920x1200 = 1.6
     Under Mesh Renderer
          Light Probes Off
          Reflection Probes Off
          Cast Shadows Off
          Uncheck Receive Shadows
          Uncheck Dynamic Occluded

     Open Materials (kind of hidden)
          Element 0
unity_dot button and choose VideoMappingMaterial
              Change the Shader for the VideomappingMaterial to AVProVideo/Unlit/Opaque

     Turn off
Mesh Collider

Choose the MediaPlayer object from the Hierarchy tab
Choose the
Add Component button
     Choose AVPro Video -> Apply to Mesh  
     Within the Apply to Mesh section:
unity_dot button and choose MediaPlayer

          Mesh  unity_dot button and choose Quad

Hit the Play arrow to check if everything is working.

Publish a Player
Save your Unity Scene

File->Build Settings...
     Click Player Settings... button
          Display Resolution Dialog   Disabled
     Under Resolution and Presentation
          Uncheck Default is Native Resolution and input your resolution if you want to control this.
Click New folder, make a new player folder on your desktop
     Select the folder, it will take a minute to build.
the player.exe
     Alt + F4 to quit the player

(If you have problems with the build, uncheck any scenes listed unScenes in Build)

Add a script to hide the mouse cursor and add an Escape button

Select the Main Camera
Select the Add Component button
     Scroll down to New script
          Type a name: hide_cursor_escape
         Double click the C# script in your Assets folder

Add this script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class hide_cursor_escape : MonoBehaviour {

 // Use this for initialization
 void Start () {
  Cursor.visible = false;
 // Update is called once per frame
 void Update () {
   if (Input.GetKeyDown(KeyCode.Escape)) {

Republish your player

Add a text overlay that fades
Select GameObject->UI->Text
     Type something in the Text field in the Inspector
    Input Pos X and Pos Y to 0
Move the Text around with the Move Tool

Add this textController script to the text, under Canvas:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;

public class textController : MonoBehaviour
    private IEnumerator fadeCoroutine;

    // Use this for initialization
    void Start()
        // title text: invisible at first!
  Text text = GetComponent<Text>();
        text.color = new Color(1f, 1f, 1f, 1f);
  this.fadeCoroutine = FadeTo(0.0f, 6f, 0.25f);

    /* Coroutine for animating the opacity of title text when a new movie is selected.
     * aTime is how long the title is visible before fade begins
     * aFadeTime is how long the title takes to disappear  */

    IEnumerator FadeTo(float aValue, float aTime, float aFadeTime)
        for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime)
            yield return null;

  Text text = GetComponent<Text>();
        float alpha = text.color.a;
        for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aFadeTime)
            Color newColor = new Color(1, 1, 1, Mathf.Lerp(alpha, aValue, t));
            text.color = newColor;
            yield return null;

        // just make sure it doesn't stick around at end of loop;
        // goes completely invisible.
        Color finalColor = new Color(1, 1, 1, aValue);
        text.color = finalColor;

Script to switch movies

Add this switch_art script to the MediaPlayer

using UnityEngine;
using System;
using System.IO;
using RenderHeads.Media.AVProVideo;

public class switch_art : MonoBehaviour
    private MediaPlayer _mediaPlayer;

    public void LoadVideo(string filePath)
        _mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, filePath, true);

    [Tooltip("Relative to StreamingAssets movie file 1.")]
    public string movie1File;
    [Tooltip("Relative to StreamingAssets movie file 2.")]
    public string movie2File;
    // Update is called once per frame
    void Update()
        if (Input.GetKeyDown(KeyCode.Alpha1))
            _mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, movie1File);
  if (Input.GetKeyDown(KeyCode.Alpha2))
            _mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, movie2File);