.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Playing a movie inside a media element

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :WPF



The code below doesn't work for me.  The window displays fine but the movie file does not play inside the media element.  I'm new to WPF and found the snippet of code in the help files, but can't get it to work.

Any help would be greatly appreciated. 

<Window x:Class="PhotoTool.UploadStatus"
  Title="Upload Progress" Height="397" Width="596" Name="uploadStatus" WindowStyle="SingleBorderWindow" WindowStartupLocation="CenterOwner" Icon="pack://application:,,,/Resources/PhotoToolIcon.ico" ResizeMode="NoResize">
    <GroupBox Header="Summary" Height="171" Margin="6,6,6,0" Name="groupBoxSummary" VerticalAlignment="Top">
    <MediaElement Height="171" Margin="6,0,264,5" Name="mediaElement" VerticalAlignment="Bottom" LoadedBehavior="Play" UnloadedBehavior="Stop" Source="pack://application:,,,/Resources/zen apple.mov">
        <EventTrigger RoutedEvent=

View Complete Post

More Related Resource Links

Now Playing: Building Custom Players with the Silverlight Media Framework


The Silverlight Media Framework is an extensible and scalable video framework upon which you can create your own player experiences. We'll walk you through a custom player project that displays suggested videos for further viewing after the current video ends.

Ben Rush

MSDN Magazine May 2010

media element and codec

What should i do to allow the user of a wpf application to be able to play in a mediaplayer the maximum number of video format?   is there something that can be installed to make wider the number of compatible format.

Transiton Effects for media element.

Hi All,I am creating movie player, which plays movies one by one reading from XML File.I am not able to solve some problems, can some one guide me through...1. I need to put transition (Animation) between first movie stop and second starts.2. There is the flicker in the screen when first movie ends and second starts.I am Playing movie in the movie element using the Storyboard and MediaTimeLine.Please help me to solve my problems.

object (movie) not playing live - works on local


I have a small web app (using vb.net/asp.net) that I have created a control with an oject and I show a short video.  The video is a .mov file.  When I run the page on my local testing machine, it works just fine.  When I move the files to the server and test it, the movie just won't play.   There are no errors on the page or anything, the movie just won't play.  I know the path to the video is correct.  When I click play, it says 'Opening Media' for 1 or 2 seconds and then it goes back to the ready state.  I'm wondering why it works locally but not on the server.  Does the server need a media player?

Here's my control:

<object id="<%= ClientID %>_Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="<%= Me.Width %>" height="<%= Me.Height %>" style="margin:0px auto; z-index:10000">    
<param name="URL" value="<%= me.VideoUrl %>" />    
<param name="autoStart" value="false" />    
<param name="uimode" value="Full" />    
<%--<param name="autoplay" value="True" />--%>    
<embed id="<%= ClientID %>_Embed" type="application/x-mplayer2"

wpf media element fast forward



I am using media element to play the movie.My current fast forward and fast rewind logic is as below.

MediaElement.position = MediaElement.position + TimeSpan.FromSeconds(10);(for fast forward) MediaElement.position = MediaElement.position - TimeSpan.FromSeconds(10);(for fast rewind)

During fast forward when the movie is over, Media Ended event is called up. I thought that it stays at the last frame where as movie ended event is called and coming out of movie.

During fast rewind, it statys at the first frame of the movie. Any idea why it is happening like that? Any suggestions/ideas to display last frame of the movie during Fast forward.



Media Element is not getting stretched


Hi I have a grid. In one of the grid cell i have a label and the label has mediaelement. When I drag the window, the label is getting stretched where as the medial element inside the label is not stretched. Its size remains static. What is the mistake i have done. This is the following code


<Border Grid.Row="1" Grid.Column="0"Background="Black" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <MediaElement Height="Auto" Name="CurrentVideo" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="UniformToFill"
                      Source="EvolvingJuliaSet.wmv" LoadedBehavior="Manual" MediaOpened="CurrentVideo_MediaOpened" Width="Auto">


TreeSelector : playing with generics and type inference

create a generic way to define a selection starting from a tree of objects, the most simpler way as possible.

Let's start with the beginning...
Here is a very simple little interface defining a node of the tree, basically, a value and the references to the child nodes.

Playing with Linq grouping: GroupByMany?

One of its features is grouping. Many people understand grouping like it is defined in Sql. Linq is implementing grouping quite the same way. Let's discover this syntax and how to make consecutive groups easier.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

LinkButton inside Repeater



I have Repeater, which consists of LinkButon and Literal. LinkButon and Literal are whole thing by implication. I want get value from Literal, when user click on corresponding LinkButton.


Textbox in ItemTemplate inside Gridview, unable to get the value


Hi. I have a itemtemplate inside a gridview.

<asp:TemplateField HeaderText="Enter OTP">
                            <asp:Label ID="Label2" runat="server"
                                style="font-family: Arial, Helvetica, sans-serif; font-size: x-small"
                                Text="PIN Num:"></asp:Label>
                            &nbsp;<asp:TextBox ID="txtPIN" runat="server" Height="21px" Width="100px"></asp:TextBox>

Embed Youtube inside Ajax Html Editor- problem



When inserting a simple embed of youtube inside the ajax editor, on firefox and chrome problems occur. On the other hand on internet explorer 8 everything works fine. I found this solution http://www.nopcommerce.com/boards/t/4228/bug-in-ajax-html-editor.aspx . 

My question is where do I find the DesignPanel.pre.js ?


Roderick Vella

UpdatePanel is not a known element - message when upgrading to 1.0 ajax


It worked on one of my old pages.  I change the web.config, renamed all the <asp.

On some aspx page it doesn't recognize the updatepanel.  It only does on one page.  If I create a new aspx page with a different name - then it works.

Should I just create a new web project ajax - then copy all my code into there?  Or is there a way to get those old pages to recognize the new ajax controls?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend