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.
SetDisplayAspect ( 16.0 / 9.0 )
rem Load Video
LoadVideo("video.wmv")
SetVideoDimensions(0,0,100,93)
PlayVideo()
duration# = GetVideoDuration()
//global variables
global seek
global px#,py#
global SeekLine
global duration#
CreateSeek()
CreateSeekLine()
rem Main loop
do
px# = GetPointerX()
py# = GetPointerY()
ControlSeek()
//Auto Seek Move
if GetSpriteExists(seek) = 1
SetSpritePositionByOffset(seek, 100.0 / duration# * GetVideoPosition(), GetSpriteYByOffset(seek))
endif
Sync()
loop
//=========================================================== FUnctions ===========================================================
Function CreateSeek()
if GetSpriteExists(Seek) = 0
seek = CreateSprite(0)
SetSPriteSize(seek,6,1.5)
SetSpritePositionByOffset(seek,3,96)
SetSpriteColor(seek, 255,0,0,255)
SetSpriteDepth(seek,0)
endif
EndFunction
Function CreateSeekLine()
if GetSpriteExists(SeekLine) = 0
SeekLine = CreateSprite(0)
SetSpritePositionByOffset(SeekLine,3,96)
SetSpriteSize(SeekLine, GetVideoWidth(), 1)
endif
EndFunction
Function ControlSeek()
if GetSpriteHit(px#, py#) = SeekLine
if GetPointerPressed() = 1
if Round(GetSpriteXByOffset(seek)) >= 3 and Round(GetSpriteXByOffset(seek)) <= 97
SetSpritePositionByOffset(seek,px#,GetSpriteYByOffset(seek))
SetVideoPosition(duration# / 100.0 * px#)
endif
endif
// Limit Seek to left
if Round(GetSpriteXByOffset(seek) < 3)
SetSpritePositionByOffset(seek, 3, GetSpriteYByOffset(seek))
endif
// Limit Seek to right
if Round(GetSpriteXByOffset(seek) > 97)
SetSpritePositionByOffset(seek, 97, GetSpriteYByOffset(seek))
endif
endif
EndFunction