Unable to play video using mediaelement in XAML in Windows store app

1

I am trying to play a video file in the media element in XAML for a windows store app. But whenever I tried to play it by setting an url pointing to a video file in the source property, I am getting the following error in the MediaFailed event.

MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT - 0xC00D36C4

My XAML is as given below

  <MediaElement x:Name="media" AutoPlay="true" Width="300" Height="300" 
              Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Margin="350,300,350,100" MediaOpened="media_MediaOpened"  MediaFailed="media_MediaFailed" />

And in the code behind

protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
    {
        var item = (ESPNHelper.VideoGallery)navigationParameter;
        media.Source = item.VideoWebUrl;
        media.Play();

    }

private void media_MediaOpened(object sender, RoutedEventArgs e)
    {
        txtStatus.Text = "Total Duration is " + media.NaturalDuration.TimeSpan.Hours + ":" + media.NaturalDuration.TimeSpan.Minutes + ":" + media.NaturalDuration.TimeSpan.Seconds; 
    }

    private void media_MediaFailed(object sender, ExceptionRoutedEventArgs e)
    {
        txtStatus.Text = "Playback failed";
    }

I tried the url in the browser and its playing there and so I am assume that there is no problem with the url.

c#
xaml
windows-8
windows-store-apps
asked on Stack Overflow Oct 28, 2012 by Amal Dev

1 Answer

0

Flash is not supported in Windows Store Apps.

See: http://msdn.microsoft.com/en-us//library/windows/apps/hh465143.aspx

answered on Stack Overflow Feb 1, 2013 by Johann

User contributions licensed under CC BY-SA 3.0