Results 1 to 6 of 6

Thread: Get Media Duration

  1. #1

    Thread Starter
    Addicted Member The Red One's Avatar
    Join Date
    Dec 2001
    Posts
    232

    Get Media Duration

    I need a function that will get the duration of a given file in this format: "00:00", the function has to support as many file types as possible and return the data as String.
    Thanx in advance for your help. RED

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    What do you mean by 'Get the duration of a file'?
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  3. #3

    Thread Starter
    Addicted Member The Red One's Avatar
    Join Date
    Dec 2001
    Posts
    232
    Get its length

  4. #4
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim ret As Double, Mint As Integer, Sec As Integer
    3. MediaPlayer1.FileName = "C:\WINDOWS.000\MEDIA\Mozart's Symphony No. 40.rmi"
    4. ret = MediaPlayer1.Duration
    5. Mint = CInt(ret / 60)
    6. Sec = ret Mod 60
    7. If Len(Sec) > 1 Then
    8. Debug.Print Mint & ":0" & Sec
    9. Else
    10. Debug.Print Mint & ":" & Sec
    11. End If
    12. End Sub

    of course works only for media player supported formats

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  5. #5

    Thread Starter
    Addicted Member The Red One's Avatar
    Join Date
    Dec 2001
    Posts
    232
    without WMP please

  6. #6
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849


    Visit http://www.wotsit.org, read the file headers for all the formats you need and calculate the duration.

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

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