MedaiPlayerSampleGUI.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using UnityEngine;
  2. using System.Collections;
  3. public class MedaiPlayerSampleGUI : MonoBehaviour {
  4. public MediaPlayerCtrl scrMedia;
  5. public bool m_bFinish = false;
  6. // Use this for initialization
  7. void Start () {
  8. scrMedia.OnEnd += OnEnd;
  9. }
  10. // Update is called once per frame
  11. void Update () {
  12. }
  13. #if !UNITY_WEBGL
  14. void OnGUI() {
  15. if( GUI.Button(new Rect(50,50,100,100),"Load"))
  16. {
  17. scrMedia.Load("EasyMovieTexture.mp4");
  18. m_bFinish = false;
  19. }
  20. if( GUI.Button(new Rect(50,200,100,100),"Play"))
  21. {
  22. scrMedia.Play();
  23. m_bFinish = false;
  24. }
  25. if( GUI.Button(new Rect(50,350,100,100),"stop"))
  26. {
  27. scrMedia.Stop();
  28. }
  29. if( GUI.Button(new Rect(50,500,100,100),"pause"))
  30. {
  31. scrMedia.Pause();
  32. }
  33. if( GUI.Button(new Rect(50,650,100,100),"Unload"))
  34. {
  35. scrMedia.UnLoad();
  36. }
  37. if( GUI.Button(new Rect(50,800,100,100), " " + m_bFinish))
  38. {
  39. }
  40. if( GUI.Button(new Rect(200,50,100,100),"SeekTo"))
  41. {
  42. scrMedia.SeekTo(10000);
  43. }
  44. if( scrMedia.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
  45. {
  46. if( GUI.Button(new Rect(200,200,100,100),scrMedia.GetSeekPosition().ToString()))
  47. {
  48. scrMedia.SetSpeed(2.0f);
  49. }
  50. if( GUI.Button(new Rect(200,350,100,100),scrMedia.GetDuration().ToString()))
  51. {
  52. scrMedia.SetSpeed(1.0f);
  53. }
  54. if( GUI.Button(new Rect(200,450,100,100),scrMedia.GetVideoWidth().ToString()))
  55. {
  56. }
  57. if( GUI.Button(new Rect(200,550,100,100),scrMedia.GetVideoHeight().ToString()))
  58. {
  59. }
  60. }
  61. if( GUI.Button(new Rect(200,650,100,100),scrMedia.GetCurrentSeekPercent().ToString()))
  62. {
  63. }
  64. if (GUI.Button(new Rect(300, 650, 100, 100), scrMedia.GetCurrentState().ToString()))
  65. {
  66. }
  67. }
  68. #endif
  69. void OnEnd()
  70. {
  71. m_bFinish = true;
  72. }
  73. }