|
-
Jul 21st, 2011, 11:17 AM
#1
Thread Starter
Member
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.
-
Jul 21st, 2011, 12:17 PM
#2
Re: Getting meida duration
-
Jul 21st, 2011, 01:36 PM
#3
Thread Starter
Member
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.
-
Jul 22nd, 2011, 04:48 AM
#4
Addicted Member
Re: Getting meida duration
I mean that shell is better idea
look:
-
Jul 22nd, 2011, 10:57 AM
#5
Thread Starter
Member
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?
-
Jul 23rd, 2011, 01:53 PM
#6
Addicted Member
Re: Getting meida duration
I use Visual Studio 2010 and windows 7x64 and it's Microsoft Shell Controls And Automation.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|