gold_sprint_lpr/Assets/Scripts/GameScene/VideoManager.cs

37 lines
940 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class VideoManager : MonoBehaviour {
private VideoPlayer videoPlayer;
private float speed {get; set; }
void Start () {
speed = 1.0f;
videoPlayer = gameObject.AddComponent<VideoPlayer>();
// TODO: Aspect Ratio is not working?
videoPlayer.aspectRatio = VideoAspectRatio.FitOutside;
Debug.Log(videoPlayer.aspectRatio);
videoPlayer.url = "/home/florent/Stockage/Works/Unity/GoldSprint/Videos/redbull/redbull_30s.webm";
videoPlayer.isLooping = true;
videoPlayer.playOnAwake = false;
videoPlayer.Prepare();
videoPlayer.Pause();
//videoPlayer.Play();
Run();
}
void Update () {
videoPlayer.playbackSpeed = speed;
}
void Run() {
videoPlayer.Play();
}
void WheelImpulse() {
}
}