Play video from IsolStorage

I am currently playing a video using MediaLauncher as follows:

var launcher = new MediaPlayerLauncher();
launcher.Location = MediaLocationType.Data;
launcher.Media = new Uri("shared/transfers/video.mp4", UriKind.Relative);
launcher.Show();

But this has a problem that it closes when you switch to another application or lock the screen, so I wanted to create a page in the application to play the video, so I can save the state.

I tried using both MediaElement and Microsoft Player Framework as follows:

var file = IsolatedStorageFile.GetUserStoreForApplication())
var stream = file.OpenFile("shared/transfers/video.mp4", FileMode.Open, FileAccess.Read))
mediaPlayer.SetSource(stream);
mediaPlayer.Play();

and like this:

mediaPlayer.Source = new Uri("ms-appdata:///local/shared/transfers/video.mp4", UriKind.RelativeOrAbsolute);
mediaPlayer.Play();

but in all four cases I get a not very useful error message 3123 An error has occurred.in the eventMediaFailed

+4
source share
1 answer

, , ID_CAP_MEDIALIB_PLAYBACK. MMF :

var file = IsolatedStorageFile.GetUserStoreForApplication())
var stream = file.OpenFile("shared/transfers/video.mp4", FileMode.Open, FileAccess.Read))
mediaPlayer.SetSource(stream);
mediaPlayer.Play();

URL

+5

All Articles