This is a migrated thread and some comments may be shown as answers.

Failed to Open Media!

3 Answers 121 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Tahir Ahmed
Top achievements
Rank 1
Tahir Ahmed asked on 16 Mar 2012, 04:55 PM
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.
 

3 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 16 Mar 2012, 05:22 PM
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 >>
0
Tahir Ahmed
Top achievements
Rank 1
answered on 16 Mar 2012, 06:43 PM
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.
0
Tahir Ahmed
Top achievements
Rank 1
answered on 16 Mar 2012, 10:00 PM
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.
Tags
MediaPlayer
Asked by
Tahir Ahmed
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Tahir Ahmed
Top achievements
Rank 1
Share this question
or