wpf c# media player questions

Posted by Sankar on Stack Overflow See other posts from Stack Overflow or by Sankar
Published on 2010-03-31T16:02:25Z Indexed on 2010/03/31 16:03 UTC
Read the original article Hit count: 382

Filed under:

I'm making a media player in wpf using c#. I had 3 questions. 1) I tried making a seeker

XAML:

<Slider Name="timelineSlider" Margin="40,91,26,0" ValueChanged="SeekToMediaPosition" Height="32" VerticalAlignment="Top" />

Code:

private void Element_MediaOpened(object sender, EventArgs e)
    {
        timelineSlider.Maximum = ply.NaturalDuration.TimeSpan.TotalMilliseconds;
    }

    private void SeekToMediaPosition(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
        int SliderValue = (int)timelineSlider.Value;
        TimeSpan ts = new TimeSpan(SliderValue, SliderValue, SliderValue, SliderValue, SliderValue);
        ply.Position = ts;
    }

When I run the program, I open the mp3 and play it but the seeker won't move. When I click on the seeker to move it to a certain position, the song stops playing but the seeker moves. What's the problem and how do I fix it?

  1. How do I create a volume increase/decrease bar?

  2. How can I open several mp3s and queue them up like a playlist?

Thank you

© Stack Overflow or respective owner

Related posts about c#