Here is my code function, nothing especially exciting going on the code.
Code: Select all
Function filemanager:PlayVideo(activefile)
Calendar:ClearInterval()
HideDisplay()
CtrlCQuit(False)
ExitOnError(False)
StopMusic(1)
CloseMusic(1)
ExitOnError(True)
OpenVideo(1, activefile)
SetVideoVolume(1,"100%")
video.width = GetAttribute(#VIDEO, 1, #ATTRWIDTH)
video.height = GetAttribute(#VIDEO, 1, #ATTRHEIGHT)
Local d, h, m, s = base:Milliseconds( GetAttribute(#VIDEO,1,#ATTRDURATION) )
Local duration
d = base:RoundTo(d,0)
h = base:RoundTo(h,0)
m = base:RoundTo(m,0)
s = base:RoundTo(s,0)
If d > 0
duration = d .. ":"
EndIf
If h > 0
duration = duration .. h .. ":"
EndIf
duration = duration .. m .. ":" .. s
CreateDisplay(#VIDEOPLAYBACKWINDOW, {Width = video.width, Height = video.height, Title = activefile .. " (" .. GetAttribute(#VIDEO,1,#ATTRFORMAT) .. ") Duration: " .. duration, Active = True, nomodeswitch=true, nohide=true, Pubscreen = application.pubscreen})
SelectDisplay(#VIDEOPLAYBACKWINDOW)
GetVideoFrame(#STARTVIDEOFRAME, 1, 1)
ExitOnError(False)
OpenDisplay(#VIDEOPLAYBACKWINDOW)
If GetLastError() = 0
ExitOnError(True)
DisplayBrush(#STARTVIDEOFRAME, 0,0)
PlayVideo(1)
SetInterval(1, filemanager_VideoMouse,2000)
base:InstallEventHandler(#VIDEOPLAYBACKWINDOW)
Else
ExitOnError(True)
base:SystemRequest(locale[688],locale[689],locale[4],#REQICON_WARNING)
filemanager:CloseVideo()
EndIf
EndFunction