private bool CanFireEvent(MediaPlayerEvent.EventType et, bool hasFired) { bool result = false; if (m_events != null && m_Control != null && !hasFired && IsHandleEvent(et)) { switch (et) { case MediaPlayerEvent.EventType.FinishedPlaying: //Debug.Log(m_Control.GetCurrentTimeMs() + " " + m_Info.GetDurationMs()); result = (!m_Control.IsLooping() && m_Control.CanPlay() && m_Control.IsFinished()); break; case MediaPlayerEvent.EventType.MetaDataReady: result = (m_Control.HasMetaData()); break; case MediaPlayerEvent.EventType.FirstFrameReady: result = (m_Texture != null && m_Control.CanPlay() && m_Control.HasMetaData() && m_Texture.GetTextureFrameCount() > 0); break; case MediaPlayerEvent.EventType.ReadyToPlay: result = (!m_Control.IsPlaying() && m_Control.CanPlay() && !m_AutoStart); break; case MediaPlayerEvent.EventType.Started: result = (m_Control.IsPlaying()); break; case MediaPlayerEvent.EventType.Stalled: result = m_Info.IsPlaybackStalled(); break; case MediaPlayerEvent.EventType.Unstalled: result = !m_Info.IsPlaybackStalled(); break; case MediaPlayerEvent.EventType.StartedSeeking: result = m_Control.IsSeeking(); break; case MediaPlayerEvent.EventType.FinishedSeeking: result = !m_Control.IsSeeking(); break; case MediaPlayerEvent.EventType.StartedBuffering: result = m_Control.IsBuffering(); break; case MediaPlayerEvent.EventType.FinishedBuffering: result = !m_Control.IsBuffering(); break; default: Debug.LogWarning("[AVProVideo] Unhandled event type"); break; } } return result; }