user3168511
user3168511

Reputation: 254

How to access recorded video in WP 8.1 app

I used this instructions to capture a video http://msdn.microsoft.com/en-us/library/windows/apps/hh452791.aspx

here is the part were the file is getting written to the app storage

var storageFile = await Windows.Storage.KnownFolders.VideosLibrary.CreateFileAsync("cameraCapture.mp4", Windows.Storage.CreationCollisionOption.GenerateUniqueName);
await _mediaCapture.StartRecordToStorageFileAsync(_profile, storageFile);

How I can access the file on an other page of the app. I want to play this video within a MediaElement (VideoLeinwand)

var stream = ???

VideoLeinwand.AutoPlay = true;
VideoLeinwand.SetSource(stream, ???);
VideoLeinwand.Play();

Thank you very much!

Upvotes: 0

Views: 147

Answers (1)

Romasz
Romasz

Reputation: 29792

If I understood correctly and you have succeded in recording a file cameraCapture.mp4, then you should be able to play it for example like this:

StorageFile mediafile = await Windows.Storage.KnownFolders.VideosLibrary.GetFileAsync("cameraCapture.mp4");
var stream = await mediafile.OpenAsync(Windows.Storage.FileAccessMode.Read);
VideoLeinwand.SetSource(stream, mediafile.ContentType);
VideoLeinwand.Play();

Upvotes: 1

Related Questions