This is a migrated thread and some comments may be shown as answers.

MediaPlayer Template Issue

2 Answers 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mick
Top achievements
Rank 1
Mick asked on 05 Mar 2012, 02:42 PM
I have the following control template:

<Style x:Key="MWMediaPlayer" TargetType="telerik:RadMediaPlayer">
            <Setter Property="FontSize" Value="10"/>
            <Setter Property="Foreground" Value="{StaticResource MediaPlayer_ForegroundTime}"/>
            <Setter Property="Volume" Value="0.5"/>
            <Setter Property="Background" Value="Black"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Top"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadMediaPlayer">
                        <Grid x:Name="LayoutRoot" Margin="{TemplateBinding Padding}">
                            <telerik:RadMediaPlayerWrapper x:Name="MediaPlayerWrapper" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" Height="{Binding VideoHeight}" Grid.Row="1" Width="{Binding VideoWidth}" Style="{StaticResource MWMediaPlayerWrapper}">
                                <Grid>
                                    <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" MaxHeight="{Binding VideoHeight}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" MaxWidth="{Binding VideoWidth}" Margin="7"/>
                                    <my:SmoothStreamingMediaElement x:Name="MediaElement2" Stretch="UniformToFill" BufferingTime="{Binding BufferingTime}" DataContext="{TemplateBinding SelectedMediaItem}" Height="{Binding VideoHeight}" Volume="{TemplateBinding Volume}" Width="{Binding VideoWidth}" SmoothStreamingSource="{Binding Source}"/>
                                </Grid>
                            </telerik:RadMediaPlayerWrapper>
                            <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <Popup x:Name="FullScreenPopup" IsOpen="False">
                                <telerik:RadMediaPlayerWrapper x:Name="PopupMediaPlayerWrapper" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}">
                                    <Rectangle x:Name="PopupMediaRectangle" DataContext="{TemplateBinding SelectedMediaItem}">
                                        <Rectangle.Fill>
                                            <VideoBrush x:Name="PopupMediaBrush" Stretch="{Binding VideoStretch}"/>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </telerik:RadMediaPlayerWrapper>
                            </Popup>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
And I use it as such:
<telerik:RadMediaPlayer x:Name="player" VerticalContentAlignment="Top" Volume="10"
                HorizontalContentAlignment="Center" Grid.Column="1" Grid.Row="2"  Grid.ColumnSpan="2" Grid.RowSpan="4" Margin="5,0,5,0"
                Width="Auto" Height="Auto"
                SelectedIndex="0" Style="{StaticResource MWMediaPlayer}" >
             
            <telerik:RadMediaItem IsStreamingSource="True" Header="{Binding CurrentStreamTitle}"
                    Source="{Binding CurrentStreamUri, Mode=OneWay}" StreamAttached="RadMediaItem_StreamAttached" Style="{StaticResource MWMediaItemTemplate}"
                    />
        </telerik:RadMediaPlayer>

However the buttons on the media player do not seem to work, and the method RadMediaItem_StreamAttached is never actually called. However playback works correctly, and I can consume the encoded content.

Does anyone know why the buttons wont actually work?

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 06 Mar 2012, 12:48 PM
Hello,

The media control buttons are placed inside the RadMediaPlayerWrapper control (not in the RadMediaPlayer itself). From the code fragment you've provided I can see you are using a style for the RadMediaPlayerWrapper. I believe the issue is related to that style.

I would like to encourage you to take advantage of the support ticketing system (http://www.telerik.com/account/support-tickets/new-support-ticket.aspx) in cases when you need a prompt response to urgent issues. This is the best way to reach our support staff - the support system assigns a response time for all of your questions, depending on your license and ensures that all questions will reach the respective developers, if needed.

Also, you will be able to send us a small sample project demonstrating the issue and including all custom styles you use for the player.

In case you didn't already read you could take a look at the following article about restyling our controls with expression blend:
http://www.telerik.com/help/silverlight/common-styling-appearance-edit-control-templates-blend.html .
Kind regards,
Hristo
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Martin
Top achievements
Rank 1
answered on 06 Mar 2012, 02:04 PM
Ticket 519593 raised
Tags
General Discussions
Asked by
Mick
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Martin
Top achievements
Rank 1
Share this question
or