123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Video;
- using System;
- using UnityEngine.UI;
- using TMPro;
- public class RemoteVideoControl : MonoBehaviour
- {
- public GameObject Icon;
- public GameObject Stop;
- bool? isStart = true;
-
- public AVProVideoPlayer avProVideoPlayer;
- public Slider slider;
-
- public TMP_Text currentTime;
-
- public TMP_Text textTotalTime;
-
- private bool IsStart;
-
- private int hour, mint;
- private float time;
-
- public void VideoStartSwitch()
- {
-
- isStart = avProVideoPlayer.IsPlaying();
- isStart = !isStart;
- Icon.SetActive(!isStart.Value);
- Stop.SetActive(isStart.Value);
- if (isStart.Value)
- {
-
- avProVideoPlayer?.Play();
- }
- else
- {
-
- avProVideoPlayer?.Pause();
- }
- }
- private void Start()
- {
- IsStart = true;
- slider.onValueChanged.AddListener(delegate { ChangeVideo(slider.value); });
- StartCoroutine(VideoTimer());
- }
- public void ChangeVideo(float value)
- {
-
-
-
-
-
-
-
-
- }
- float max;
- private IEnumerator VideoTimer()
- {
- while (true)
- {
- yield return new WaitForSeconds(0.5f);
- if (avProVideoPlayer.IsVideoReady()&& !AVideoSlide.isDown)
- {
- textTotalTime.text = string.Format("{0}:{1}", (avProVideoPlayer.GetMaxTimer() / 60).ToString("00"), (avProVideoPlayer.GetMaxTimer() % 60).ToString("00"));
- currentTime.text = string.Format("{0}:{1}", (avProVideoPlayer.GetNowTimer() / 60).ToString("00"), (avProVideoPlayer.GetNowTimer() % 60).ToString("00"));
- slider.value = avProVideoPlayer.GetNowTimer() / avProVideoPlayer.GetMaxTimer();
- if (slider.value > 0.99)
- {
- Icon.SetActive(true);
- Stop.SetActive(false);
- }
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
|