Adding replay button to Expression Encoder 2 SP1 Silverlight 2.0 media templates

There are several other articles describing how to edit Silverlight 2.0 templates shipped with Expression encoder 2.0 SP1.  These are some MSDN article explaining this here and here.

I am assuming that you have already opened your Encoder media template in Visual Studio.

After opening the template in Visual Studio

1. Navigate to the MediaPlayer project and open MediaPlayer.cs to edit

Edit Silverlight Encoder Template 1

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Edit below code in GoToPlaylistItem method as following

Edit Silverlight Encoder Template 2

change it to …

 else if (playlistItemIndex >= Playlist.Count)
            {
                // Reached end -- flag that playback is paused.
                // Show Replay button

                ShowReplayButton();
            }
  
 3. Add new Function ShowReplayButton
  
 public void ShowReplayButton()
        {
            m_inPlayState = false;
            m_currentPlaylistIndex = 0;
            DisplayPoster(m_currentPlaylistIndex);
            if (m_mediaElement != null)
            {
                m_mediaElement.Stop();
                m_mediaElement.AutoPlay = false;

            }

            if (m_buttonStart != null)
            {
                m_buttonStart.Visibility = Visibility.Visible;

            }
        }

Note: I did not create Xaml button for replay, instead I am just going to pop the big Start Button the template shows in the middle. You should be able to create any Xaml control and show it

You should be good to go after building the project. Hope this helps