Failed to Open Media!

4 posts, 1 answers
  1. Tahir Ahmed
    Tahir Ahmed avatar
    11 posts
    Member since:
    May 2011

    Posted 16 Mar 2012 Link to this post

    Hello,

    I am testing a simple implementation of Rad Silverlight MediaPlayer but it is not working, whenever I click on play button it says "Failed to Open Media!".

        <Grid x:Name="LayoutRoot">
            <telerik:RadMediaPlayer x:Name="player" Header="Sample Video">
                <telerik:RadMediaItem Name="MyMediaItem" IsStreamingSource="True" Title="My Video" Source="/vids/BF3.wmv" StreamAttached="RadMediaItem_StreamAttached"></telerik:RadMediaItem>
            </telerik:RadMediaPlayer>
        </Grid>

            private void RadMediaItem_StreamAttached(object sender, EventArgs e)
            {
                var item = sender as RadMediaItem;
                if (item != null)
                {
                    var adaptiveSource = new AdaptiveStreamingSource();
                    adaptiveSource.MediaElement = player.MediaElement;
                    adaptiveSource.ManifestUrl = item.Source;
                    adaptiveSource.StartPlayback();
                }
            }

    I have placed vids folder in Bin, Debug and main project folder where App.xaml is located but it is not working. I have already encoded the video in Expression Encoder 3. I checked this thread as well.

    http://www.telerik.com/community/forums/silverlight/media-player/a-simple-understanding.aspx 

    also added proper references using this thread

    http://www.telerik.com/community/forums/silverlight/media-player/rad-media-player-where-is-adaptivestreaming-dll.aspx 

    But it is still not working. What should I do ? Please help.
     
  2. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 16 Mar 2012 Link to this post

    Hi Tahir,

    From your code snippet I noticed that you're setting the source of the MediaItem to a wmv vide, but if you want to use smooth streaming you need to point the source of the RadMediaItem to the manifest file of the video.
    Please have a look at this demo sample and this help article. They can help you implement your scenario.

    Let us know if we can further assist you.

    Greetings,
    Tina Stancheva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Tahir Ahmed
    Tahir Ahmed avatar
    11 posts
    Member since:
    May 2011

    Posted 16 Mar 2012 Link to this post

    Thanks Tina for pointing that out and providing helpful links I just started with Silverlight Tools so don't have any knowledge about them, I was just following the example "SmoothStreaming" and didn't pay attention to the URL of RadMediaItem, it looks like it requires some study of Expression Encoder.

    For example if I want to play a simple media file like a WMV or MP4 file without smooth streaming then what should I do ? can you provide an example ?

    Thanks.
  5. Tahir Ahmed
    Tahir Ahmed avatar
    11 posts
    Member since:
    May 2011

    Posted 16 Mar 2012 Link to this post

    okay got it work with the following code

            <telerik:RadMediaPlayer x:Name="player" Header="Sample Video">
                <telerik:RadMediaItem Name="MyMediaItem" Title="My Video" Source="/vids/BF3.wmv" ></telerik:RadMediaItem>
            </telerik:RadMediaPlayer>

    I removed IsStreamingSource = "True" and then it worked.

    Might help some beginner like me :)

    Marking your answer Tina, since it showed me the right direction, thanks.
Back to Top