• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 940
  • Last Modified:

How do I use the silverlight video player?

Hi,

I am attempting to create a silverlight application within visual studio 2008 that will play an mp4 video file. I have downloaded the visual studio silverlight extensions and tools and the silverlight sdk 3.0. I have downloaded the SMF dll files (Microsoft.SilverlightMediaFramework.dll, Microsoft.SilverlightMediaFramework.Player.dll, Microsoft.Web.Media.SmoothStreaming.dll) and referenced these within my application. My MainPage.xaml looks like the attached but when I run my application I get a "visual studio must close error"? Can I not reference mp4 files like I have within my xaml page? How do I play mp4 files through a silverlight application for my users to view online? I've read about the MediaPlayer control but I believe that is now out of date....shame, as that approach seemed simple.

Any help appreciated,

Martin.
<UserControl x:Class="PetexSilverlightApplication.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="clr-namespace:Microsoft.SilverlightMediaFramework.Player;assembly=Microsoft.SilverlightMediaFramework.Player"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
  <Grid x:Name="LayoutRoot" Background="White">
        <p:Player>
            <p:CoreSmoothStreamingMediaElement
                AutoPlay="True"
                SmoothStreamingSource="C:\asp.net\Visual Studio 2008\Petex\SilverLight\PetexSilverlightApplication\PetexSilverlightApplication.Web\App_LocalResources\PETROLEUM EXPERTS.mp4"
                />
        </p:Player>
            
    </Grid>
</UserControl>

Open in new window

0
MartinPetex
Asked:
MartinPetex
  • 7
  • 4
1 Solution
 
Reza RadCommented:
why you use .dll s directly?
could you see mediaplayer control in toolbox of visual studio? what version of VS you use?
0
 
MartinPetexAuthor Commented:
reza,

The reason why I am using the dll's directly is because I cannot see the mediaplayer control in my toolbox, it doesn't seem to ship with silverlight sdk 3.0? I am using Visual Studio 2008.

Martin.
0
 
Reza RadCommented:
OK
you can add these silverlight controls in visual studio
just donwload this file and install it:
silvelight3_tools.exe
http://www.microsoft.com/downloads/details.aspx?familyid=9442B0F2-7465-417A-88F3-5E7B5409E9DD&displaylang=en

maybe you need this file too:
silverlight_developer.exe

both of above can be found on internet

0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
MartinPetexAuthor Commented:
reza,

I have downloaded the silverlight3_tools.exe where i now seem to have a MediaElement control available within the toolbox from the MainPage.xaml page but still no MediaPlayer control?? Where can I download the silverlight_developer.exe from?

Thanks.
0
 
Reza RadCommented:
Did it set up correctly? or errors happened?
and another question what project type you created in visual studio now?
It must be Silverlight application and then you can see media element in toolbox.

0
 
Reza RadCommented:
if the silverlight3_tools installed correctly then you don't need silverlight_developer.exe

0
 
MartinPetexAuthor Commented:
reza,

I can see the media element control, it's the media player control that I cannot see. I'm just looking to use something that will quickly let me show video and audio, this is why I am wanting the media player control. What attributes of the media element control do I have to reference to build something similar to the media player control?....play/stop/pause buttons, timeline viewer etc. Code would be appreciated.

Martin.
0
 
Reza RadCommented:
Don't worry about different names, media element is the media player control in vs2008
you can use it like this:


<MediaElement Source="2.wmv" Name="myMediaElement"
     Width="450" Height="250" Stretch="Fill"
      AutoPlay="True"/>


0
 
MartinPetexAuthor Commented:
reza,

From the link you provided it looks like I have to physically create the play/stop buttons etc myself? Is there not a standard template (like the silverlight 2.0 media player control) I can use to get something up quickly? I also noticed that mp4 files are not supported, is there anyway I can force the media element control to play mp4 files?

Thanks.
0
 
Reza RadCommented:
As I know, you must handle play/stop buttons yourself in media element.
and also you can play .mp4 files in silverlight3 look at this for example:

http://www.progmic.com/2009/06/how-to-play-mpeg-video-via-silverlight-3/
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now