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

Disable Auto Play - Click Play Button

2 Answers 161 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
sayitfast
Top achievements
Rank 2
Iron
sayitfast asked on 15 Apr 2010, 08:57 AM
I just started playing with Silverlight and the Rad Controls.

I have a question regarding using a manual play button.  I have my control configured and have two media items. I have AutoPlay set to false. When I click an item from the Play list it starts to play immediately. I want the user to click play... what am I missing here?

Thanks!

<Grid x:Name="LayoutRoot">  
        <telerikMedia:RadMediaPlayer x:Name="player" VerticalContentAlignment="Top" Height="Auto" Width="Auto" 
                HorizontalContentAlignment="Center" 
           telerik:StyleManager.Theme="Summer" 
           IsPlaylistVisible="True" FullScreenChanged="RadMediaPlayer_FullScreenChanged" AutoPlay="False">  
            <telerikMedia:RadMediaItem  
                ImageSource="http://www.inln.ru/Blog/image.axd?picture=150px-Silverlight.png" 
                Header="Adding Instant Messaging to Any Site" 
                Source="http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T03.wmv">  
                <telerikMedia:RadMediaChapter Position="00:03:30">  
                    <Grid MaxWidth="150">  
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="Auto" /> 
                            <ColumnDefinition /> 
                        </Grid.ColumnDefinitions> 
                        <Image Source="http://www.inln.ru/Blog/image.axd?picture=150px-Silverlight.png" Width="25" Margin="4" /> 
                        <TextBlock Text="Ensuaring good performance" TextWrapping="Wrap" Grid.Column="1" Margin="4" /> 
                    </Grid> 
                </telerikMedia:RadMediaChapter> 
                <telerikMedia:RadMediaChapter Position="00:10:00">  
                    <TextBlock Text="10 min has elapsed" TextWrapping="Wrap" /> 
                </telerikMedia:RadMediaChapter> 
                <telerikMedia:RadMediaChapter Position="00:15:00">  
                    <TextBlock Text="15 min has elapsed" TextWrapping="Wrap" /> 
                </telerikMedia:RadMediaChapter> 
            </telerikMedia:RadMediaItem> 
            <telerikMedia:RadMediaItem  
                ImageSource="http://www.inln.ru/Blog/image.axd?picture=150px-Silverlight.png" 
                Header="The Dynamics Duo talk about CRM and Silverlight" 
                Source="http://mschnlnine.vo.llnwd.net/d1/ch9/7/1/5/1/2/4/DynamicsDuoCRMSilverlight_ch9.wmv" FontSize="10" FontFamily="Arial" FontWeight="Bold">  
                <telerikMedia:RadMediaChapter Content="Chapter 1" Position="00:00:50" /> 
                <telerikMedia:RadMediaChapter Content="Chapter 2" Position="00:03:00" /> 
            </telerikMedia:RadMediaItem> 
        </telerikMedia:RadMediaPlayer> 
    </Grid> 
</UserControl> 
 


2 Answers, 1 is accepted

Sort by
0
Miro Miroslavov
Telerik team
answered on 15 Apr 2010, 01:56 PM
Hi sayitfast,

Originally AutoPlay means whether to start playing from the first item in the playlist or not. But it is now obsolete and is replaced with SelectedIndex = 0.

Currently you can't do what you need out-of-the-box, but with some extra code.
You'll need to handle the MediaOpened
<player:RadMediaPlayer x:Name="player" MediaOpened="player_MediaOpened" SelectedIndex="0">

And Pause the video.

void player_MediaOpened(object sender, RadRoutedEventArgs e)
{          
    player.MediaElement.Pause();           
}

Hope this works for you.

Greetings,
Miro Miroslavov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
sayitfast
Top achievements
Rank 2
Iron
answered on 15 Apr 2010, 08:03 PM
That does work... THANKS!

Seems to me though that should be an exposed property... Having videos autostart is not always a good idea.

Thanks.
Tags
MediaPlayer
Asked by
sayitfast
Top achievements
Rank 2
Iron
Answers by
Miro Miroslavov
Telerik team
sayitfast
Top achievements
Rank 2
Iron
Share this question
or