Displaying duration of a directx object.
I'm trying to create my own controls for a directx object that will show a video, specifically a trackbar so the user can slide it along and the video will fast forward or reverse along with it.
I'm taking this one step at a time and the first thing I want to do is show the duration of the loaded video, but I'm having a little difficulty. I've created a string object and i'm using the Following:
GetDuration( "Direct Show" )
Which I assume will get the length of the video loaded in, but I can't get the text object to display the duration. I tried using the following:
val(GetDuration( "Direct Show" ))
But it gives an error: "Mixed string and numbers". How to I get the string object to display the duration? Or are there any other objects that would allow me to display the duration? Any help appreciated.
Re: Displaying duration of a directx object.
str$(GetDuration("Direct Show")) i'd imagine
Re: Displaying duration of a directx object.
Val() is for converting a string to a value.
Str$() is for converting a value to a string.
Re: Displaying duration of a directx object.
Already tried that :)
Get the error "Please enter a numeric expression".
Re: Displaying duration of a directx object.
Re: Displaying duration of a directx object.
Are you sure you are setting the alterable string and not the paragraph number?
Re: Displaying duration of a directx object.
Str$(GetDuration( "Direct Show" ))
This works fine for me.. just tried it!
Re: Displaying duration of a directx object.
I wonder why it's giving me the error when I 'Check current expression'.
http://www.madladdesigns.co.uk/temp/clipboard02.jpg
Re: Displaying duration of a directx object.
Did you try it without the str$()?
The number of the paragraph would be a value not a string.
Re: Displaying duration of a directx object.
Quote:
Are you sure you are setting the alterable string and not the paragraph number?
Ahh, thanks Jamie, now I see it's asking for a paragraph, I assumed it was just displaying text. Do I have to set an alterable string / value somewhere and read that in?
Re: Displaying duration of a directx object.
Quote:
Did you try it without the str$()?
The number of the paragraph would be a value not a string.
I tried it with srt$(), with val() and without either! If I have it without, I don't get an error but the string just says 'text'.
Re: Displaying duration of a directx object.
Could one of you guys whip up a simple example for me to look at? I'm sure it's something stupid I'm missing out. :)
Re: Displaying duration of a directx object.
One of my thoughts is what if its trying to set the paragraph to one that doesn't exist?
Do you know what is coming out of the function?
IE can you set it to a counter just not a paragraph in a string?
Re: Displaying duration of a directx object.
COUNTER! That's the one, thank you!!! Now it's displaying 840789. Believe it or not, I actually tried the score counter, forgot about the plain ol' COUNTER. Thanks Jeff, now I have to translate this to the track bar so the vid can be moved through...
Wish me luck! :)
Re: Displaying duration of a directx object.
As jamie said earlier; set paragraph will ask for a number which represents an alterable string you have already set, to display it in the string object choose the option 'Set alterable string' then enter Str$(GetDuration( "Direct Show" )).
It should be noted that duration is generally about duration in seconds * 1000, however you can trick it with silly sample rates so your probably best to use a different extension to find a more useful duration indication.