I want to achieve scrubbing of a paused video. Click and drag to scrub.
The result is mixed. It seems to work almost alright on WIndows- with the attached video. Windows fails to load longer webm videos as I noted in another thread.
https://forum.thegamecreators.com/thread/221818
I used an ugly hack to get it to seek and stop at a frame ,noticing that the video cannot seek while paused.
So scrubbing with this example and the bird works on windows.
The problem comes when broadcasting it to an android device. The scrubbing does not work whatsoever there. I was wondering is its a problem with my code, or a problem with appgamekit's current video player.
Here is the source code(I am also attaching the video):
rem
rem Video Playback Example
SetWindowAllowResize( 1 )
rem Load Video
LoadVideo("bird.webm")
//SetVideoDimensions(0,0,100,93)
rem Main loop
cursorToVideoPosition as float
do
print(GetScreenBoundsRight())
if GetPointerState()=1
rem Reset video
PlayVideo()
cursorToVideoPosition = renormalize(GetPointerX(),0,GetScreenBoundsRight(),0,GetVideoDuration())
print(cursorToVideoPosition)
SetVideoPosition(abs(cursorToVideoPosition))
PauseVideo()
Sleep(30)
endif
//print(GetPointerX())
//print(GetVideoDuration())
// print(normalizeValue ( GetPointerX(), 0.0, 100.0 ))
// print(denormalize(normalizeValue ( GetPointerX(), 0.0, 100.0 ),0,GetVideoDuration()))
Sync()
loop
function normalizeValue(value as float,min,max)
normalized as float
normalized = (value - min) / (max - min)
endfunction normalized
function denormalize(normalized as float, min as float, max as float)
denormalized as float
denormalized = (normalized * (max - min) + min)
endfunction denormalized
function renormalize(value as float,oldMin as float,oldMax as float,newMin as float,newMax as float)
renormalized as float
renormalized = denormalize(normalizeValue ( value, oldMin, oldMax ),newMin,newMax)
endfunction renormalized
Btw how do we get printing to work with the video player? When I load any video, printing is allcovered by it and its hard to debug. Can AppGameKit print to console?