MartinPetex
asked on
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.SilverlightMedi aFramework .dll, Microsoft.SilverlightMedia Framework. Player.dll , Microsoft.Web.Media.Smooth Streaming. 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.
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.SilverlightMedi
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>
ASKER
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.
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.
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
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
ASKER
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.
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.
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.
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.
if the silverlight3_tools installed correctly then you don't need silverlight_developer.exe
ASKER
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/paus e buttons, timeline viewer etc. Code would be appreciated.
Martin.
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/paus
Martin.
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"/>
you can use it like this:
<MediaElement Source="2.wmv" Name="myMediaElement"
Width="450" Height="250" Stretch="Fill"
AutoPlay="True"/>
this is a good example:
http://www.wrox.com/WileyCDA/Section/Building-Silverlight-Video-Applications.id-306542.html
http://www.wrox.com/WileyCDA/Section/Building-Silverlight-Video-Applications.id-306542.html
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
could you see mediaplayer control in toolbox of visual studio? what version of VS you use?