Error playing a .mov video from Videos folder (using MediaElement)

0

What am I trying?

I am trying to load a quicktime movie from the Video Library like this:

async void SetupVideoAsyncAndPlay() {
    StorageFolder folder = 
               await KnownFolders.VideosLibrary.GetFolderAsync("Video Folder");
    StorageFile file = await folder.GetFileAsync("test_video.mov");

    // Ensure a file was selected
    if (file != null) {
        var fileStream = 
                await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);

        Video.SetSource(fileStream, file.ContentType);
        Video.Play();
    }
}

What have I tried?

I have come to this after a lot of digging. First I had the Windows.Storage.FileAccessMode.ReadWrite to only Read and didn't fire any event. Now, it fires the MediaFailed Event (registered it using Video.MediaOpened += RightVideo_MediaOpened;)

In the MediaFailed Event I get the following:

ErrorMessage = "MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT - 0xC00D36C4"

I have the MediaElement in the Visual Tree (one of the possible problems) since I declare this element in the XAML.

Additionally, I have tried to run the same video without the filestream (directly from the application bundle) and it works.

Also, if I replace the StorageFile/FileStream code by a Picker it works :

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.FileTypeFilter.Add(".mov");
StorageFile file = await openPicker.PickSingleFileAsync();
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

Note that I gave permissions in the Package.appmanifest for the Video folder.

video
windows-8
quicktime
mediaelement
mov
asked on Stack Overflow Dec 27, 2012 by Tiago Almeida • edited Jan 4, 2013 by Tiago Almeida

1 Answer

0

When are you calling SetupVideoAsyncAndPlay? I remember having the same problem and resolved it by making sure that the MediaElement initialization is only done after it has been loaded into the VisualTree (after receiving the Loaded event).

Hope that helps.

answered on Stack Overflow Jan 4, 2013 by Meik

User contributions licensed under CC BY-SA 3.0