title: Silverlight media player
body: <p>I am using VSTS 2008 with C# to develop Silverlight application embedded in web page of an ASP.Net web application. I have embedded in XAML a MediaElement item. My question is, I want to embed the page a Silverlight media player, which could let end user to control the MediaElement item manually to -- play/pause/stop/rewind/forward. Are there any references samples?</p>
  
  <p>thanks in advance,
  George</p>
  
  <p>EDIT1: add more accurate requirements,</p>
  
  <p>Actually, I want to control play manually, which means I want to handle the player play/pause/stop/rewind/forward events and add my code for the event handlers to control the MediaElement and do something else.</p>
  
  <p>EDIT2: My needs are, I want to play two overlapped video. Screen as background video and camera as foreground video (place at right bottom corner). Here is my modification of code, my current issue is, only background video is played, foreground right bottom video is never played. Does anyone have any ideas why?</p>
  
  <p>BTW: my modified code and current work is based on <a href="http://www.codeplex.com/sl2videoplayer" rel="nofollow noreferrer">http://www.codeplex.com/sl2videoplayer</a></p>
  
  <p><a href="http://www.yourfilehost.com/media.php?cat=other&amp;file=sl2videoplayer_24325_new.zip" rel="nofollow noreferrer">http://www.yourfilehost.com/media.php?cat=other&amp;file=sl2videoplayer_24325_new.zip</a></p>
  
  <p>Here is a brief description of my major modified code,</p>
  
  <p>mediaControls.xaml.cs</p>
  
  <pre><code>private MediaElement _media = null;
  private MediaElement _camera = null;
  
  public MediaElement Camera
  {
      set
      {
          _camera = value;
      }
  }
  
  void btnPlay_Checked(object sender, RoutedEventArgs e)
  {
      _camera.Play();            
      _media.Play();
      OnPlayClicked();
  }
  </code></pre>
  
  <p>Page.xaml</p>
  
  <pre><code>    &lt;MediaElement HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="mediaPlayer" Stretch="Uniform" VerticalAlignment="Stretch" AutoPlay="false"/&gt;
      &lt;MediaElement Width="100" Height="100" x:Name="cameraPlayer" AutoPlay="false" HorizontalAlignment="Right" VerticalAlignment="Bottom"/&gt;
  </code></pre>
  
  <p>Page.xaml.cs</p>
  
  <pre><code>cameraPlayer.Source = App.Current.Resources["c"] as Uri;
  </code></pre>
  
  <p>App.xaml.cs (Application_Startup function)</p>
  
  <pre><code>        else if (item.Key.ToLower() == "c")
          {
              FormatUri(e.InitParams["c"].ToString(), "c", false);
          }
  </code></pre>
  
  <p>default.html</p>
  
  <pre><code>        &lt;param name="initParams" value="cc=true,markers=true,markerpath=markers_movie21.xml,m=http://localhost/screen.wmv,c=http://localhost/camera.wmv" /&gt;
  </code></pre>