How to change progress bar to progress ring in playerframework

Topics: Windows 8 Xaml
May 13, 2013 at 5:52 AM
Edited May 13, 2013 at 5:53 AM
I want to change progress bar to progress ring in playerframework how can i do this is their any property. While streaming video content
Coordinator
May 17, 2013 at 6:21 PM
Here's one way to accomplish this:

Add new Xaml for BufferingView to your page or App xaml:
          <Style TargetType="mmppf:BufferingView" x:Key="BufferingViewRing">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="mmppf:BufferingView">
                            <Grid>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="MediaStates">
                                        <VisualState x:Name="Opening">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsActive" Storyboard.TargetName="ProgressIndicator">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ProgressIndicator">
                                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.01" Value="Visible"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Paused"/>
                                        <VisualState x:Name="Playing"/>
                                        <VisualState x:Name="Closed"/>
                                        <VisualState x:Name="Buffering">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsActive" Storyboard.TargetName="ProgressIndicator">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ProgressIndicator">
                                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.01" Value="Visible"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <ProgressRing Width="150" Height="150" x:Name="ProgressIndicator" IsActive="False" Visibility="Collapsed" IsHitTestVisible="False"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
Then, swap out the BufferingPlugin for a new one that uses this style:
public PlayerPage()
{
    this.InitializeComponent();
    player.Initializing += player_Initializing;
}

void player_Initializing(object sender, MediaPlayerDeferrableEventArgs e)
{
    var bufferingPlugin = player.Plugins.OfType<BufferingPlugin>().First();
    player.Plugins.Remove(bufferingPlugin);
    bufferingPlugin = new BufferingPlugin();
    bufferingPlugin.BufferingViewStyle = Application.Current.Resources["BufferingViewRing"] as Style;
    player.Plugins.Add(bufferingPlugin);
}