ChangeVideoExample.cs 587 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using UnityEngine;
  3. namespace RenderHeads.Media.AVProVideo.Demos
  4. {
  5. public class ChangeVideoExample : MonoBehaviour
  6. {
  7. public void NewVideo(string filePath)
  8. {
  9. this.mp.m_AutoStart = true;
  10. this.mp.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, filePath, false);
  11. }
  12. private void OnGUI()
  13. {
  14. if (GUILayout.Button("video1", new GUILayoutOption[0]))
  15. {
  16. this.NewVideo("video1.mp4");
  17. }
  18. if (GUILayout.Button("video2", new GUILayoutOption[0]))
  19. {
  20. this.NewVideo("video2.mp4");
  21. }
  22. }
  23. public MediaPlayer mp;
  24. }
  25. }