Item Template and Smooth Stream

5 posts, 0 answers
  1. Luis
    Luis avatar
    5 posts
    Member since:
    Jun 2008

    Posted 01 May 2010 Link to this post

    Hi there,
    I have the following template that is almost as the one on the example, with two added properties: IsStreamingSource and
    StreamAttached. However it does not activate the event handler on the StreamAttached.

    <telerikMedia:RadMediaPlayer x:Name="player"   
                                         VerticalContentAlignment="Top"   
                                         HorizontalContentAlignment="Center" 
                                         FullScreenChanged="player_FullScreenChanged"   
                                         AutoPlaylistAdvance="False">  
                <telerikMedia:RadMediaPlayer.ItemTemplate> 
                    <DataTemplate> 
                        <telerik:ContainerBinding.ContainerBindings> 
                            <telerik:ContainerBindingCollection> 
                                <telerik:ContainerBinding PropertyName="Source" Binding="{Binding Source}" /> 
                                <telerik:ContainerBinding PropertyName="IsStreamingSource" Binding="{Binding IsStreamingSource}" /> 
                                <telerik:ContainerBinding PropertyName="StreamAttached" Binding="{Binding StreamAttached}" /> 
                            </telerik:ContainerBindingCollection> 
                        </telerik:ContainerBinding.ContainerBindings> 
     
                        <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">  
                            <Image Source="{Binding Image}" Width="200" Height="180" Stretch="Uniform" Margin="4" /> 
                            <TextBlock Text="{Binding Title}" VerticalAlignment="Center" Margin="4" /> 
                        </StackPanel> 
                    </DataTemplate> 
                </telerikMedia:RadMediaPlayer.ItemTemplate> 
            </telerikMedia:RadMediaPlayer> 
     
     

    Can you please help me to make this to work.
    Thanks

  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 05 May 2010 Link to this post

    Hello Luis,

    StreamAttached is an event, not a property and you can't bind it with ContainerBinding.  Currently you can't also handle the event using class handler, because StreamAttached isn't RoutedEvent. We logged this and will be fixed for next releases. Till then it appears that you can't bind the RadMediaPlayer to items that are Smooth Streaming sources. You'll need to create the RadMediaItems yourself and attach the StreamAttached handlers manually in the code.
    If you have further questions regarding RadMediaPlayer, please contact us.

    Sincerely yours,
    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.
  3. DevCraft banner
  4. Luis
    Luis avatar
    5 posts
    Member since:
    Jun 2008

    Posted 05 May 2010 Link to this post

    Thanks for the response. Can you please provide an example of your suggestion?
  5. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 11 May 2010 Link to this post

    Hello Luis,

     You can write code to create RadMediaItems like follows (suppose you have RadMediaPlayer called player and model classes that holds media related data - Mediaitem - the classes you bind in the previous exampe):

    foreach (MediaItem item in GetMediaItems())
    {
        RadMediaItem radItem = new RadMediaItem();
        radItem .Source = item.Source;
        radItem.IsStreamingSource = item.IsStreamingSource;
        radItem.StreamAttached = new EventHandler(item_StreamAttached);
    }

    And this is your the EventHandler for StreamAttached:
    void item_StreamAttached(object sender, EventArgs e)
            {
                //Your code here for handling streams.
            }

    Hope this helps you.

    Regards,
    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.
  6. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 11 May 2010 Link to this post

    Hello Luis,

     You can write code to create RadMediaItems like follows (suppose you have RadMediaPlayer called player and model classes that holds media related data - Mediaitem - the classes you bind in the previous exampe):

    foreach (MediaItem item in GetMediaItems())
    {
        RadMediaItem radItem = new RadMediaItem();
        radItem .Source = item.Source;
        radItem.IsStreamingSource = item.IsStreamingSource;
        radItem.StreamAttached = new EventHandler(item_StreamAttached);
          player.Items.Add(radItem);
    }

    And this is your the EventHandler for StreamAttached:
    void item_StreamAttached(object sender, EventArgs e)
            {
                //Your code here for handling streams.
            }

    Hope this helps you.


    Regards,
    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.
Back to Top
DevCraft banner