locked
Media video are not playing when recevied source?

    Question

  •  void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
            {
                try
                {
                    DataModel.YoutubeVideo value = e.NavigationParameter as DataModel.YoutubeVideo;
                    if(!string.IsNullOrWhiteSpace(value.id))
                    {
                        txttitle.Text = value.title;
                        Mediaplayer.Source = value.youtubelink;
                    }
                }
                catch
                {
                    throw new NotImplementedException();
                }
               
            }


    <StackPanel>
                                <MediaElement Name="Mediaplayer" Width="650" Height="384" MediaFailed="Mediaplayer_MediaFailed" MediaOpened="Mediaplayer_MediaOpened" Margin="1,0,0,0" AutoPlay="True"></MediaElement>
                            </StackPanel>

    Source :http://www.youtube.com/watch?v=_OBlgSz8sSM&feature=youtube_gdata

    string uri youtubelink{get;set;}

    Saturday, August 09, 2014 6:36 AM

Answers

  • Hi Le Thien Hoang,

    MediaElement seems can not directly play the Youtube link. You will get a error message once you apply the source directly to the MediaElement: MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT - 0xC00D36C4

    I would suggest you to set a MediaElement_MediaFailed event to see what is the exactly error message. And you are using DataModel.YoutubeVideo which is not a original Windows Store App API, maybe he did some URI convert somewhere in the code, for this reason, you may ask code owner why the youtube cannot be played in Windows Store App.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, August 11, 2014 2:15 AM
    Moderator