0

This is the situation.

I have a MainPage.Xaml, within this MainPage.Xaml I have embedded a UserControl (VideoWidget.Xaml) (LayouRoot.Children).

VideoWidget.Xaml has a mediaElement embedded in its LayoutRoot.

I'm trying to Pause/Play the MediaElement (mediaElement1) from MainPage.Xaml but does not respond.

e.g.

public MainPage()
    {
        // Required to initialize variables
        InitializeComponent();            
        Video testVideo = new Video();

        VideoWidget video = new VideoWidget(testVideo);
        videoWidget.Height = 246;
        videoWidget.Width = 290;
        LayoutRoot.Children.Add(video);
        video.mediaElement1.play();
      }

The All methods for mediaElement are not responsive. Help please.

Mohit

user849953
  • 57
  • 1
  • 2
  • 10

1 Answers1

0

Try putting test control buttons inside the VideoWidget itself. Does that work? If so, there may be a problem with the way you are exposing the mediaElement in the VideoWidget as a public member.

Dave Swersky
  • 34,502
  • 9
  • 78
  • 118
  • hi Dave, I tried hardcoding the Pause method in the VideoWidget Constructor just after media.source = URI. Still no luck! – user849953 Apr 11 '12 at 16:10
  • e.g. mediaElement1.Pause(); mediaElement1.Source = new Uri(video.fileLocation); mediaElement1.AutoPlay = true; mediaElement1.Pause(); – user849953 Apr 11 '12 at 16:16
  • Take a look: http://stackoverflow.com/questions/478017/why-doesnt-mediaelement-work-in-silverlight – Dave Swersky Apr 11 '12 at 16:18