using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using BITKit; using UnityEngine.Video; namespace BITKit.Media { public abstract class MediaPlayer : Provider { [Header(Constant.Header.Settings)] public bool playOnStart; [Header(Constant.Header.State)] public bool isPlaying; public float currentTime; [Header(Constant.Header.Components)] public TPlayer player; [Header(Constant.Header.Events)] public UnityEvent onStartPlay = new(); public UnityEvent onStopPlay = new(); public UnityEvent onPlay = new(); public UnityEvent onPause = new(); public UnityEvent onSetTotalTime; public UnityEvent onSetTotalTimeAsString; public UnityEvent onTime; public UnityEvent onTimeAsString; protected virtual void OnStart() { } public virtual void Play() { } public virtual void Stop() { } public virtual void PlayOrPause() { } public virtual void UpdateProgess() { } public virtual void SetNormalizeTime(float time) { } void Start() { OnStart(); if (playOnStart) { Play(); } } void Update() { if (isPlaying) { UpdateProgess(); } } } }