/// <summary> /// Waits for the video to finish, then calls the OnVideoComplete event /// </summary> private void WaitForCompletion() { int waitTime = avgTimePerFrame != 0 ? (int)((float)avgTimePerFrame / 10000) : 20; try { while (videoDuration > currentPosition) { Thread.Sleep(waitTime); } if (OnVideoComplete != null) { OnVideoComplete.Invoke(this, EventArgs.Empty); } } catch { } }
/// <summary> /// Waits for the video to finish, then calls the OnVideoComplete event /// </summary> private void WaitForCompletion(object state) { int waitTime = Info.AvgTimePerFrame != 0 ? (int)((float)Info.AvgTimePerFrame / 10000) : 20; try { while (Info.Duration > currentPosition) { if (StoppingEvent.WaitOne(0)) { return; } Thread.Sleep(waitTime); } if (OnVideoComplete != null) { OnVideoComplete.Invoke(this, EventArgs.Empty); } } catch { } }