32 lines
785 B
C#
32 lines
785 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using RenderHeads.Media.AVProVideo;
|
|
|
|
public class PlayAVProVideo : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
string videoPath;
|
|
private MediaPlayer _mediaPlayer;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
_mediaPlayer = GetComponent<MediaPlayer>();
|
|
if (_mediaPlayer != null)
|
|
{
|
|
Debug.Log("Panorama is loading");
|
|
_mediaPlayer.OpenMedia(new MediaPath(videoPath, MediaPathType.RelativeToPersistentDataFolder), autoPlay: true);
|
|
}
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (_mediaPlayer != null)
|
|
{
|
|
Debug.Log("Panorama is closing");
|
|
_mediaPlayer.CloseMedia();
|
|
}
|
|
}
|
|
}
|