Silverlight is dead, long live Silverlight 5: TrickPlay or Double your speed
If you have watched any of my videos, then being able to speed them up is a great idea, now if there was only a way to get rid of the ummmmmmmmms.
How do you do that?
Silverlight.NET
- Normally you would go to https://silverlight.net and expect to type in “TrickPlay” or MediaElement to get a search result with a cool video, but not in this case, for TrickPlay, you can skip it for the MediaElement. The videos appear to discuss, and there is a Spanish video on the use of MediaElement in Silverlight 4
MSDN does have a two solid articles:
- Good reference, small but useful code snippet:
- Overall good article:
Discussion
You can do TrickPlay with no code behind, I downloaded an MP4 video from Channel 9, change the line under the MediaElement Source=”demo.mp4” to the name of the video you want to use in your example.
Naturally you can use code behind, but I wanted to make this a simple and easy blog for you to enjoy!
Code Snippet
- <UserControl
- x:Class="TrickyPlayExample.MainPage"
- xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
- d:DesignHeight="300"
- d:DesignWidth="400" xmlns:sdk="https://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
- <Grid x:Name="LayoutRoot" Background="White" Width="400">
- <!-- Volume slider. This slider allows a Volume range between 0 and 1. -->
- <StackPanel
- Height="300"
- HorizontalAlignment="Left"
- Margin="12,0,0,0"
- Name="stackPanel1"
- VerticalAlignment="Top" Width="360">
- <TextBlock
- Height="23">
- Video speed use blue slider
- </TextBlock>
- <TextBlock
- Text="{Binding ElementName=media,Path=PlaybackRate,StringFormat=\\cf1 {0\\cf1 }x}"
- Height="23"/>
- <Slider Opacity="1"
- Background="Blue"
- Minimum="1"
- Maximum="2"
- SmallChange="0.5"
- LargeChange="0.5"
- Height="30"
- Value="{Binding ElementName=media,Path=PlaybackRate,Mode=TwoWay}" />
- <TextBlock
- Foreground="Black"
- Height="16"
- FontWeight="ExtraBold">Volume (use red Slider)</TextBlock>
- <Slider Name="volumeSlider"
- Minimum="0"
- Maximum="1"
- Background="Red"
- Width="Auto"
- Height="30"
- Value="{Binding ElementName=media, Path=Volume, Mode=TwoWay}" />
- <MediaElement
- x:Name="media"
- Source="demo.mp4"
- Width="266"
- Height="186"/>
- </StackPanel>
- </Grid>
- </UserControl>