Hello,
MediaElement
does not include an API for downloading files.
Downloading the video and playing the video are separate steps.
For the download part of the file, you can download the file via HTTPClient
during the event where the video starts playing.
<toolkit:MediaElement Source="url_link"
MediaOpened="MediaElement_MediaOpened" />
private async void MediaElement_MediaOpened(object sender, EventArgs e)
{
var media = sender as MediaElement;
if (media != null)
{
var url = media.Source.ToString();
using (var webclient = new HttpClient())
{
// For information on how to download files using HTTPClient and calculate download progress, please search for Progress bar with HttpClient keywords.
}
}
}
how can i download video into local storage but hidden from user
You could refer to File system helpers for downloading the video into app Cache directory.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.