Results 1 to 3 of 3

Thread: Countdown Minutes:Seconds Left in Audio File

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Location
    Wichita, KS, US
    Posts
    10

    Post

    I'm using the Windows Media Player to play audio files (mainly mp3s), and have it hidden (so I am unable to see the time remaining in one of the bars), and was wanting to have a label that showed how much time was remaining in the song. I've been using the MediaPlayer.SelectionEnd and MediaPlayer.CurrentPosition, along with a timer (interval at 1000), to try and display the time remaining, but i can't come close to getting it to work properly (with the label formatted like: "00:00"). All help is greatly apprecieated.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    Try:
    Code:
    Private Sub Command1_Click()
        With MediaPlayer1
            .FileName = "C:\Windows\Media\The Microsoft Sound.wav"
            .Play
            While .PlayState = mpPlaying
                Caption = .CurrentPosition
                DoEvents
            Wend
        End With
    End Sub
    Alternatively use the Microsoft Multimedia Control:
    Code:
    Private Sub Command1_Click()
        With MMControl1
            .Visible = False
            .UpdateInterval = 100
            .TimeFormat = mciFormatMilliseconds
            .FileName = "C:\Windows\Media\The Microsoft Sound.wav"
            .Command = "Open"
            .Command = "Play"
        End With
    End Sub
    
    Private Sub MMControl1_StatusUpdate()
        Caption = MMControl1.Position / 1000
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    ajyoung@pressenter.com


  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Location
    Wichita, KS, US
    Posts
    10

    Post

    Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width