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

Book with more than 5 video players

3 Answers 46 Views
Book
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 25 May 2010, 10:00 PM
Hi there,
I have a simple book application where each page contains a video player (Framework Player). It works ok with 5 or less pages, but when the number of pages is more than 5, it drops (or unload) the excess pages in FIFO basis.
My question is: Is there any place to configure for more than 5 players?
using System.Net;  
using System.Windows;  
using System.Windows.Controls;  
using System.Windows.Documents;  
using System.Windows.Input;  
using System.Windows.Media;  
using System.Windows.Media.Animation;  
using System.Windows.Shapes;  
using Microsoft.SilverlightMediaFramework.Player;  
using Microsoft.Web.Media.SmoothStreaming;  
using Telerik.Windows.Controls;  
 
 
namespace TestPlayer 
{  
    public partial class MainPage : UserControl  
    {  
        public MainPage()  
        {  
            InitializeComponent();  
            int NumberOfPages = 5;  
            setBook(NumberOfPages);  
                 
        }  
 
 
        private void setBook(int numOfPages)  
        {  
            //same source for all players  
            string BigBunny = "http://video3.smoothhd.com.edgesuite.net/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest";  
            //Create book  
            RadBook myBook = new RadBook();  
            myBook.Margin = new Thickness(10, 10, 10, 10);  
            myBook.Width = LayoutRoot.Width;  
            myBook.Height = LayoutRoot.Height;  
            myBook.PageChanged += new Telerik.Windows.RadRoutedEventHandler(myBook_PageChanged);  
            int pageNumber = 1;  
            for (int i = 0; i < numOfPages; i++)  
            {  
                Grid myGrid = new Grid();  
 
                TextBlock myText = new TextBlock();  
                myText.Text = "Page " + pageNumber++.ToString();  
                myText.HorizontalAlignment = HorizontalAlignment.Center;  
                myText.VerticalAlignment = VerticalAlignment.Top;  
                myGrid.Children.Add(myText);  
                Player myPlayer = new Player();  
                myPlayer.Name = "player_" + i.ToString();  
                myPlayer.PlayControlClicked += new RoutedEventHandler(myPlayer_PlayControlClicked);  
                myPlayer.Width = 600;  
                myPlayer.Height = 400;  
                myPlayer.Margin = new Thickness(10, 15, 10, 10);  
                myPlayer.VerticalAlignment = VerticalAlignment.Top;  
                CoreSmoothStreamingMediaElement myMediaElement = new CoreSmoothStreamingMediaElement();  
                myMediaElement.AutoPlay = false;  
                myMediaElement.SmoothStreamingSource = new Uri(BigBunny, UriKind.Absolute);  
                myPlayer.MediaElement = myMediaElement;  
 
                myGrid.Children.Add(myPlayer);  
                myBook.Items.Add(myGrid);  
            }  
 
 
            //Add book to LayoutRoot  
            LayoutRoot.Children.Add(myBook);  
        }  
 
        void myBook_PageChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)  
        {  
            pausePlayers();  
        }  
 
        void myPlayer_PlayControlClicked(object sender, RoutedEventArgs e)  
        {  
            pausePlayers();  
            Player myPlayer = (Player)sender;  
            myPlayer.MediaElement.Play();  
        }  
 
 
        private void pausePlayers()  
        {  
            RadBook myBook = (RadBook)LayoutRoot.FindChildByType<RadBook>();  
            for (int i = 0; i < myBook.Items.Count; i++)  
            {  
                Grid myGrid = (Grid)myBook.Items[i];  
                Player myPlayer = (Player)myGrid.FindChildByType<Player>();  
                myPlayer.MediaElement.Pause();  
            }  
        }  
 
         
    }  
}  
 
The following is the code used.

3 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 28 May 2010, 01:45 PM
Hi Luis,

Thank you for your feedback. Currently this scenario is not supported. For virtualization purposes, RadBook reuses its item containers thus the issue you experience. We have plans to introduce a property IsVirtualizing (similar to RadTreeView) that will allow you to define whether you want RadBook to reuse its item containers or not. We will do our best to provide this functionality for our 2010 Q2 release which is scheduled for the middle of July. I've logged this feature request in our PITS under the name "Book: Add IsVirtualizing property" and it will be available for tracking tomorrow the latest. Let me know if you have additional questions or comments regarding this topic.

All the best,
Kiril Stanoev
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
Luis
Top achievements
Rank 1
answered on 15 Jun 2010, 09:56 PM
Thanks for your support.
I downloaded the Q1 SP2, which according to the "What is New...";  the property IsVirtualizing for RadBook now is available, however I was not able to make it work. 
Please, can you show me how to use this property.

Thanks again, this property will allow me to create nice educational material.
0
Tina Stancheva
Telerik team
answered on 18 Jun 2010, 04:25 PM
Hi Luis,

In order to see how the property works, you can generate a 1 000 000 items in the book and try setting the IsVirtualizing property to true and false. You will notice that when the IsVirtualizing property is set to false, the items cannot be properly displayed.

Give this a try and let us know if you need more info.

All the best,
Tina Stancheva
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
Tags
Book
Asked by
Luis
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Luis
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or