You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
870 B

using UnityEngine;
using RenderHeads.Media.AVProVideo;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo.Demos
{
/// <summary>
/// A demo that shows how to use scripting to load videos
/// </summary>
public class ChangeVideoExample : MonoBehaviour
{
[SerializeField]
private MediaPlayer _mediaPlayer = null;
public void LoadVideo(string filePath)
{
_mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, filePath, true);
}
void OnGUI()
{
if (GUILayout.Button("video1"))
{
LoadVideo("video1.mp4");
}
if (GUILayout.Button("video2"))
{
LoadVideo("video2.mp4");
}
}
}
}