#include "Totvs.ch"
User Function TMedia()
local nLeft := 1
local nTopBtn := 202
local lShowBar:= .F.
local nVolume := 70
local cFile := "c:/dir/file.mp3"
DEFINE MSDIALOG oDlg TITLE "TMediaPlayer" FROM 0,0 TO 424,404 PIXEL
oMedia := TMediaPlayer():New(1,nLeft,200,200,oDlg,cFile,nVolume,lShowBar)
TButton():New( nTopBtn, nLeft, "Open", oDlg,;
{|| oMedia:openFile( FWInputBox("Escolha o arquivo", "c:/garbage/") ) },28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
TButton():New( nTopBtn, nLeft+=28, "Play", oDlg,;
{|| oMedia:play() },28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
TButton():New( nTopBtn, nLeft+=28, "Pause", oDlg,;
{|| oMedia:pause() },28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
TButton():New( nTopBtn, nLeft+=28, "Stop", oDlg,;
{|| oMedia:stop() },28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
TButton():New( nTopBtn, nLeft+=28, "SetVolume", oDlg,;
{|| oMedia:setVolume( Val( FWInputBox("Escolha a altura do volume [0-100]", cValToChar(oMedia:nVolume)) ) ) },;
28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
TButton():New( nTopBtn, nLeft+=28, "GetVolume", oDlg,;
{|| MsgAlert( oMedia:nVolume ) },28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
TButton():New( nTopBtn, nLeft+=28, "ShowBar", oDlg,;
{|| lShowBar:=!lShowBar, oMedia:setShowBar( lShowBar ) },28,010,,,.F.,.T.,.F.,,.F.,,,.F. )
ACTIVATE MSDIALOG oDlg CENTERED
return