Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Move Seek to video height

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 21st Apr 2017 10:14 Edited at: 21st Apr 2017 10:16
Sorry for Mistake Title (Move Seek according to video Width)


Hi.

I wrote below code for move seek sprite according to GetVideoPosition() command that work very well. I create a seek line sprite according to GetVideoWidth() command that seek move on it. now I want video duration alignment to Seek Line sprite but I don't know how can do it.



please guide me to fix it.

Thanks.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2017 13:07
This

should be


This is untested as I'm at work, but *should* work in theory, and allows for the moving and resizing of the video. (Providing that you resize the seekline sprite as well.)
Signature removed by mod because it's larger than 600x120... please resize and try again.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 21st Apr 2017 13:16
Thanks Mobiius.

but it don't work correctly.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2017 13:53
Quote: "but it don't work correctly."

Ooh, I love games where you have to figure out what the other person means because they give you absolutely no information to go on!
Signature removed by mod because it's larger than 600x120... please resize and try again.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 21st Apr 2017 14:11 Edited at: 21st Apr 2017 15:42
Quote: "This is untested as I'm at work, but *should* work in theory"


I don't know your theory is right or not. so I can't do anything because it won't work.

your result code is -320, mean you set seek sprite to -320 in x position.

so I think this Piece of your code should be remove.



so, seek sprite begin moving at 0. but it's move fast and we need a way to alignment seek speed according to video duration.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2017 16:20
Quote: "GetSpriteXByOffset( SeekLine ) - ( GetSpriteWidth( SeekLine ) * 0.5 )"

This bit gets the left edge of your seekLine sprite. (I'm assuming that its been positioned using it's offset.
GetSpriteXByOffset( SeekLine ) gets what's assumed to be half way along the sprite.
( GetSpriteWidth( SeekLine ) * 0.5 ) This gets half the sprites width, to be subtracted from the above center of the sprite. to get the left hand edge.

(If you don't use SetSpritePositionByOffset then this would push the left over to the left of the SeekLine sprite, which appears to be what you're describing. You could either change your system to always use SetSpritePositionByOffset, or change the first bit of the equation to simply GetSpriteX( SeekLine ))


Quote: "( GetSpriteWidth( SeekLine ) * ( GetVideoPosition() / GetVideoDuration() ) ) )"

This gets the percentage through the video you currently are (In the range 0.0 to 1.0) then multiplies the SeekLine sprites width by this percentage to get the position along the line to put the seek head.
Signature removed by mod because it's larger than 600x120... please resize and try again.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 21st Apr 2017 16:44 Edited at: 21st Apr 2017 16:49
this is result of your code:

PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 21st Apr 2017 22:26 Edited at: 21st Apr 2017 22:29
Your Auto Seek Move code is incorrect. So is the ControlSeek() function.
I rewrote these sections so you can get an idea on how to do a different approach...clicking on the SeekLine works now.
Also, you should set a display ratio when using the percentage system. I used 16/9, you might have another aspect ratio and should change it accordingly...

I used a *.wmv version of the video, cause my system doesn't support mp4 at the moment.

PSY LABS Games
Coders don't die, they just gosub without return
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Apr 2017 07:48
Thanks PSY. it's now work very well
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Apr 2017 13:16
is there any command for set sprite on over video? SetSpriteDepth() command don't work on video and cant find any command for change video depth.
i think currently I can decrease height and width video Dimensions. right?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 23rd Apr 2017 20:00
hey PSY.

this part of code in ControlSeek() function don't work on large videos and don't move seek to clicked position.

PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 23rd Apr 2017 21:04 Edited at: 23rd Apr 2017 21:05
Check duration in main loop then or loop until video has finished loading the meta data!

HELP on GetVideoDuration():
Returns the number of seconds the video lasts from start to finish. If this returns 0 then call it in a loop with Sync() to wait for the video to finish loading the meta data. If it returns less than 0 then this platform does not support this command or an error occured. example: duration = GetVideoDuration() if ( duration = 0 ) repeat Sync() duration = GetVideoDuration() until duration != 0 endif
PSY LABS Games
Coders don't die, they just gosub without return
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 24th Apr 2017 12:14 Edited at: 24th Apr 2017 13:29
Thanks. I fixed it.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 24th Apr 2017 14:44
could you explanation more about this algorithm:



Thanks.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Apr 2017 15:42
I'm sure it's easy enough to work out.
It would be easier if it were arranged like this..

Signature removed by mod because it's larger than 600x120... please resize and try again.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 24th Apr 2017 21:09
Quote: "I'm sure it's easy enough to work out.
It would be easier if it were arranged like this.."


Thanks Mobiius

but I mean is, This code is similar to the one ordered in math? because i many years is forget mathematical. and it's big Challenge in my programming.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Apr 2017 23:40 Edited at: 24th Apr 2017 23:45
Quote: "( 100.0 / duration# ) * GetVideoPosition()"

i guess the 100.0 is the GetVirtualWidth()
GetVideoDuration() returns the length in seconds
so 100 width = 100 seconds (length as example)
100 width / 100 seconds = 1
so position 0 is left and 100 is right at screen if you multiply 1.0 by GetVideoPosition() and the video length has maximal 100 seconds.

https://en.wikipedia.org/wiki/Percentage
AGK (Steam) V2017.03.31 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 24th Apr 2017 23:52
^that

Assume the video length was 120 seconds
120 seconds = 100%
1 second = 100% / 120
Actual seconds = GetVideoPosition() = 100% / 120 * GetVideoPosition() = actual percentage based position

Just standard rule of three
PSY LABS Games
Coders don't die, they just gosub without return
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 25th Apr 2017 10:33
This isn't the type of maths you forget.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Apr 2017 15:39
Thanks Markus.
Thanks PSY.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 13th May 2017 12:50
Quote: "Assume the video length was 120 seconds
120 seconds = 100%
1 second = 100% / 120
Actual seconds = GetVideoPosition() = 100% / 120 * GetVideoPosition() = actual percentage based position"


For virtual resolution, if my resolution was (1280 x 800) I should divide 1280 / 120 * GetVideoPosition() ?
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 13th May 2017 16:14
Correct
PSY LABS Games
Coders don't die, they just gosub without return
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 13th May 2017 16:41 Edited at: 13th May 2017 17:08
Thanks PSY.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 17th May 2017 12:23
Quote: "Assume the video length was 120 seconds
120 seconds = 100%
1 second = 100% / 120
Actual seconds = GetVideoPosition() = 100% / 120 * GetVideoPosition() = actual percentage based position

Just standard rule of three

"


do you know what is standard formula for calculate change video frame with mouse click?

I think this code is not standard formula:





PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 17th May 2017 20:52
It is if you use a percentage based approach.
Otherwise, it's SetVideoPosition(duration# / XResolution * MouseX), assuming the slider bar matches the screen width.

Check your postbox, I sent you a more detailed explanation
PSY LABS Games
Coders don't die, they just gosub without return
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 17th May 2017 22:11
Thanks PSY.
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 18th May 2017 20:44
Welcome
PSY LABS Games
Coders don't die, they just gosub without return

Login to post a reply

Server time is: 2024-11-24 13:31:29
Your offset time is: 2024-11-24 13:31:29