Results 1 to 6 of 6

Thread: Getting meida duration

  1. #1

    Thread Starter
    Member Shadow45o's Avatar
    Join Date
    Sep 2008
    Posts
    51

    Getting meida duration

    Ok, first off, I have been searching around and trying to figure out how to get media, specifically videos, length/duration. I know that you can use the Windows Media Player object to achieve this, however, I need to get the duration of some media that is not supported by windows media player.

    I am developing my own media player in VS 2010 that will be utilizing the VLC media player component since VLC is able to play most (if not all) media formats. So far I have tried playing around with "My.Computer.FileSystem.GetFileInfo("path").length" but all this gets is the media's length in Bytes. What I am trying to achieve is the format of hh:mm:ss for pretty much every format, not just Windows Media Formats, but real media, .mkv, etc.

    As I said, I have been searching around for a while and have finally broken down and am asking.

    Thank you in advance for your help.

  2. #2

  3. #3

    Thread Starter
    Member Shadow45o's Avatar
    Join Date
    Sep 2008
    Posts
    51

    Re: Getting meida duration

    Am I missing something? I copied the code into a new class called 'MCI' and then created a test button that would change a label to the time found.

    Code:
    Label1.text = MCI.GetMediaLength("C:\Users\UserName\Videos\Video name.avi")
    Every time I run this I keep getting the message that the media length can not be retrieved. I have tried this with multiple formats (.wav, .avi, .mp3) However, I did get it to work once, with a 1 second WAVE file. So, am I not calling it right, or could someone maybe better describe the code from http://www.vbforums.com/showpost.php...63&postcount=2? Is this suppose to be able to work with all formats?

    As I said, I tried it with several formats with it failing to get the time each try. Thank you again in advance for the help.
    Last edited by Shadow45o; Jul 21st, 2011 at 01:40 PM.

  4. #4
    Addicted Member
    Join Date
    Jun 2008
    Location
    Macedonia
    Posts
    188

    Re: Getting meida duration

    I mean that shell is better idea
    look:
    MACEDONIA 4EVER

  5. #5

    Thread Starter
    Member Shadow45o's Avatar
    Join Date
    Sep 2008
    Posts
    51

    Re: Getting meida duration

    Ok, the shell commands look like it might work...except for the fact that for whatever reason, the "Microsoft Shell Controls And Automation" does not exist in the 'COM' list. Any ideas? Is it under a different name in visual studio 2010?

  6. #6
    Addicted Member
    Join Date
    Jun 2008
    Location
    Macedonia
    Posts
    188

    Re: Getting meida duration

    I use Visual Studio 2010 and windows 7x64 and it's Microsoft Shell Controls And Automation.
    MACEDONIA 4EVER

Tags for this Thread

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