none
Need help with setting up buffer progress bar!

    General discussion

  • Hey all,
    I was wondering if anyone could help me write the method/tell me what is wrong with my buffer method for a video playing Silverlight application.

    I do not have the code on this system but will post it later when I get back tonight, however my psuedocode for my method is basically:

    progressbar1 is the name of my progress bar object.

    Start "bufferTimer" and set the timer to "tick" every 50 milliseconds.

    Inside the timerTick method
    {
        progressbar1.value = mediaelement1.BufferingProgress;
    }

    Please let me know if that is the correct way to code the method or not.  My results when running the application is a near instant full buffer load, however when testing on other systems, the buffer bar always goes from 0 to 50 and then 50 to 100.  (I do not believe the buffering should be that consistent).

    Thanks in advance!
    Andrew 

    Monday, April 09, 2012 3:47 PM

All replies

  • Hi andrewmaibui,

    Based on your description, it's hard to reproduce your issue. Could you simple your project and  upload it to skydrive. Then provide a link.

    In addition, explain the issue more clearly will help us to resolve it.

    Best wishes,

    Wednesday, April 11, 2012 3:02 AM
  • public MainPage()
            {
                InitializeComponent();
                InitializeBufferTimer();
                BufferTimer.Start();                                                         
            }
    private void InitializeBufferTimer()
            {
                BufferTimer = new DispatcherTimer();
                BufferTimer.Interval = TimeSpan.FromMilliseconds(1); //Interval                is 0.05 Seconds
                BufferTimer.Tick += new EventHandler(BufferTimer_Tick);            
            }
    
    void BufferTimer_Tick(object sender, EventArgs e)
            {
                double valuePB = mediaElement1.BufferingProgress * 100;
                progressBar2.Value = valuePB;
            }
    That's the exact code I have in my .cs class. Is that how a buffer progress bar should be coded?  Using YouTube as an example,
    when a video is selected, the UI Progress bar of the video player has two main features, the first is to display the time elapsed, the second
    is to show how much of the buffer has loaded. I am basically trying to create the 2nd feature, but, for now, want to create a seperate progress bar
    for the buffer. 
    Saturday, April 14, 2012 5:46 AM