52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using UMP;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using RenderHeads.Media.AVProVideo;
|
|
using MediaPlayer = RenderHeads.Media.AVProVideo.MediaPlayer;
|
|
|
|
[RequireComponent(typeof(UniversalMediaPlayer))]
|
|
public class UMPTool : MonoBehaviour
|
|
{
|
|
public string path;
|
|
public Text Message;
|
|
public UniversalMediaPlayer ump;
|
|
public MediaPlayer mediaPlayer;
|
|
public MediaPath mediaPath;
|
|
|
|
public string deviceId;
|
|
public string channelId;
|
|
|
|
void Start()
|
|
{
|
|
Init();
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
/*
|
|
Debug.Log(mediaPlayer.MediaPath.Path);
|
|
if (gameObject.activeInHierarchy)
|
|
{
|
|
mediaPlayer.gameObject.SetActive(true);
|
|
}
|
|
*/
|
|
/*
|
|
ump = GetComponent<UniversalMediaPlayer>();
|
|
// ump.Path = Application.streamingAssetsPath + path;
|
|
ump.AddEncounteredErrorEvent(() => {
|
|
Message.text = "当前链接失效!";
|
|
Message.color = Color.red;
|
|
ump.RenderingObjects[0].GetComponent<RawImage>().texture = Texture2D.whiteTexture;
|
|
ump.RenderingObjects[0].GetComponent<RawImage>().color = new Color(0, 0, 0, 0.5f);
|
|
});
|
|
ump.AddPlayingEvent(() =>
|
|
{
|
|
Message.text = "";
|
|
ump.RenderingObjects[0].GetComponent<RawImage>().color = Color.white;
|
|
});
|
|
|
|
ump.Play();
|
|
*/
|
|
}
|
|
}
|