Can't Play mp4 File in MediaPlayerElement from https Storage Site

Generation Continuum 191 Reputation points

I'm developing a UWP app that has a collection of properties of type MediaSource and each element in the collection is assigned to a source from a URI class:

Video = MediaSource.CreateFromUri(new Uri(""))

The video is supposed to play inside a MediaPlayerElement control. The control's source is bound to the MediaSource property through a view model. The video in each element of the collection changes when the user clicks a Next AppBarButton controlled by a Command Object. The control played each video correctly when I tested the above code using a localhost site on an IIS server I set up:

Video = MediaSource.CreateFromUri(new Uri("http://locahost/images/video.mp4"))

But when I switched to the above https URI, I get the following error from the MediaPlayerElement control-Unidentified file type or invalid path.

Any suggestions on how I can fix this?

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Generation Continuum 191 Reputation points

    I was able to find a solution to my problem. The links I was using to access my mp4 files required authentication. I contacted Google to see if I could get links that didn't require authentication and they gave me API links to my files to use. I replaced the links with the API links and thankfully the files played!

    I didn't get a chance to use the HttpClientGetStreamAsync(Uri) method that was suggested, but I'll keep that code in mind. Thanks so much!

    0 comments No comments

0 additional answers

Sort by: Most helpful