1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using UnityEngine;
- namespace UMP
- {
- public class EventsHandlerExample : MonoBehaviour
- {
- public UniversalMediaPlayer _mediaPlayer;
- void Start()
- {
- if (_mediaPlayer != null)
- {
- _mediaPlayer.AddPlayingEvent(OnPlayerPlaying);
- _mediaPlayer.AddTimeChangedEvent(OnPlayerTimeChanged);
- _mediaPlayer.AddPositionChangedEvent(OnPlayerPositionChanged);
- _mediaPlayer.AddSnapshotTakenEvent(OnPlayerSnapshotTaken);
- }
- }
- public void Play()
- {
- _mediaPlayer.Play();
- }
- public void OnPlayerOpening()
- {
- Debug.Log("OnPlayerOpening");
- }
- public void OnPlayerBuffering()
- {
- Debug.Log("OnPlayerBuffering");
- }
- public void OnPlayerPlaying()
- {
- Debug.Log("OnPlayerPlaying");
- }
- public void OnPlayerPaused()
- {
- Debug.Log("OnPlayerPaused");
- }
- public void OnPlayerStopped()
- {
- Debug.Log("OnPlayerStopped");
- }
- public void OnPlayerEndReached()
- {
- Debug.Log("OnPlayerEndReached");
- }
- public void OnPlayerEncounteredError()
- {
- Debug.Log("OnPlayerEncounteredError");
- }
- public void OnPlayerTimeChanged(long time)
- {
- Debug.Log("OnPlayerTimeChanged: " + time);
- }
- public void OnPlayerPositionChanged(float position)
- {
- Debug.Log("OnPlayerPositionChanged: " + position);
- }
- public void OnPlayerSnapshotTaken(string path)
- {
- Debug.Log("OnPlayerSnapshotTaken: " + path);
- }
- }
- }
|