using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using System; public class VideoSlider : MonoBehaviour,IPointerDownHandler,IPointerUpHandler,IDragHandler { private Slider videoSlider; private bool isPlaying; private VideoPanel videoPanel; // Use this for initialization void Start() { videoSlider = GetComponent(); videoPanel = transform.parent.parent.GetComponent(); } // Update is called once per frame void Update() { } public void OnPointerDown(PointerEventData eventData) { videoPanel.skip = true; if (videoPanel.videoPlayer.isPlaying) { isPlaying = true; videoPanel.Pause(); } else { isPlaying = false; } } public void OnPointerUp(PointerEventData eventData) { videoPanel.videoPlayer.time = videoSlider.value; videoPanel.skip = false; if (isPlaying) { videoPanel.Play(); } } public void OnDrag(PointerEventData eventData) { videoPanel.videoPlayer.time = videoSlider.value; } }