private void CancelNextDownload(Media video) {
DownloadItem VideoDownload = downloadManager.DownloadsList.FirstOrDefault(d => d.Request.MediaId == video.MediaId && !d.IsCompleted);
if (VideoDownload != null) {
// Removes autoplay from the next video.
VideoDownload.QueuePos = -1;
// Cancel the download if progress is less than 40%
if (VideoDownload.ProgressValue < 40 && playMode != PlayerMode.Manual)
VideoDownload.Status = DownloadStatus.Canceled;
}
}