private bool isForward = true;
private long frame;
private void OnSliderDragStart()
{
VideoPlayer.Pause();
}
private void OnSliderDragEnd()
{
frame = VideoPlayer.frameCount * VideoSlider.value ;
isForward = frame >= VideoPlayer.frame;
VideoPlayer.time = length * VideoSlider.value ;
VideoPlayer.Play();
}
private void Update()
{
if (VideoPlayer != null && VideoPlayer.isPrepared)
{
if (isForward && VideoPlayer.frame < frame)
? ? ? ? return;
? ? ? ? if (!isForward && VideoPlayer.frame > frame)
? ? ? ? ? ? return;
? ? ? ? VideoSlider.value = VideoPlayer.time / VideoPlayer.length ;
}
}
|