In this tutorial we will create a start play button on launch of your Hulu inspired SilverLight video player.
Steps
1- Set the media element’s AutoPlay=”False”
2- Place a button in the middle of the stage
3- Replace the graphics on normal and mouseover states
4- on click of start button set the buttons visibility to collapsed, set the media element to play
View all parts of the tutorial
Part 1 – Building a Play-Pause control
Part 2 – Loading external video
Part 3 – Building a Progress Bar
Part 4 – Building a Download Progress Bar
Part 5 – Building a Volume Control
Part 6 – Building the Time Display
Part 7 – Volume Slider control
Part 8 – Start playing button
XAML code
<Button x:Name="startButton" Height="107.3" Margin="261,81,261,83" Style="{StaticResource ButtonStyle1}" Content="Button" Cursor="Hand" Click="startPlaying"/>
<MediaElement x:Name="mp" Source="http://www.paulyanez.com/interactive/blog/HD/darkknight.wmv" DownloadProgressChanged="downloadProgressHandler" Margin="0,0,-1,-1" IsMuted="{Binding IsChecked, ElementName=volumeControl, Mode=OneWay}" Volume="{Binding Value, ElementName=vol, Mode=OneWay}" AutoPlay="False" />
C# code
startButton.Visibility = Visibility.Collapsed; controlBar.Visibility = Visibility.Visible; mp.Play();