1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.EventSystems;
- using UnityEngine.UI;
- using XRTool.Util;
- public class AVideoSlide : PointerHandler
- {
- public AVProVideoPlayer aVdieoPlayer;
- public Slider slider;
- public static bool isDown = false;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- //if (slider && vidoPlayer && isDown == false)
- //{
- // slider.value = float.Parse(vidoPlayer.frame.ToString()) / float.Parse(vidoPlayer.frameCount.ToString());
- //}
- }
- void sliderChanged(float per)
- {
- if (slider && aVdieoPlayer)
- {
- aVdieoPlayer.SetSeek( per);
- //float targetFrame = vidoPlayer.frameCount * per;
- //vidoPlayer.frame = (long)targetFrame;
- }
- }
- public override void OnPointerDown(PointerEventData eventData)
- {
- base.OnPointerDown(eventData);
- aVdieoPlayer.Pause();
- isDown = true;
- }
- public override void OnPointerUp(PointerEventData eventData)
- {
- base.OnPointerUp(eventData);
- sliderChanged(slider.value);
- TimerMgr.Instance.CreateTimer(()=> {
- aVdieoPlayer.Play();
- },0.2f);
- isDown = false;
- }
-
- }
|