Buenas noches para todos..
Estoy intentando reproducir un vídeo de tipo mp4.
Ya corrí el ejemplo testvid.prg y me funciona bien pero solo con *.avi
Alguien sabe como hacerlo?
#include "fivewin.ch"
Function Main()
MostraWmp()
Return nil
*-----------------------------------------------------------------------------
Function MostraWmp()
Local oDlg, oActiveX, cRadioTv:="http://www.tempofm.com.br/tempofm3.asx"
DEFINE DIALOG oDlg TITLE "WMP" FROM 1,1 TO 360,430 PIXEL
oDlg:lHelpIcon := .F.
oDlg:nStyle := nOr( WS_MINIMIZEBOX ,WS_VISIBLE, WS_CAPTION, WS_SYSMENU ) //, WS_THICKFRAME
ACTIVATE DIALOG oDlg CENTERED; //NOMODAL;
ON INIT ( oActiveX := ActivaWMP( oDlg, oActiveX, cRadioTv ), ;
ToolBar(oDlg, oActiveX), MenuRadioTv(oDlg, oActiveX) ) ;
VALID ( oActiveX:DO( "Stop" ), oActiveX:End(), .T. )
Return nil
*-----------------------------------------------------------------------------
Function ActivaWMP( oDlg, oActiveX, cRadioTv )
oActiveX = TActiveX():New( oDlg, "MediaPlayer.MediaPlayer.1",;
oDlg:nTop+30, oDlg:nLeft, oDlg:nRight, oDlg:nBottom-50 )
oActiveX:SetProp( "FileName", cRadioTv )
Return( oActiveX )
*-----------------------------------------------------------------------------
Function ToolBar(oDlg, oActiveX)
Local oToolBar, cTitle:="Radio Tempo FM", oFont, oFont2
DEFINE FONT oFont NAME "Verdana" SIZE 0, -14 BOLD
DEFINE FONT oFont2 NAME "Verdana" SIZE 0, -08
DEFINE ButtonBar oToolBar SIZE 50,28 OF oDlg TOP 2007
@ 002, 002 COMBOBOX cTitle ITEMS {"Radio Tempo FM", ;
"Radio Verdes Mares", ;
"-------------------------",;
"Tv Canção Nova", ;
"Tv Rai News (Italia)", ;
"-------------------------",;
"Escolher Arquivo"} PIXEL ;
OF oToolBar SIZE 250,150 ;
ON CHANGE MudaRadioTV(cTitle, oDlg, oActiveX)
Return nil
*-----------------------------------------------------------------------------
Static Function MenuRadioTv(oDlg, oActiveX)
Local oMenu
MENU oMenu 2007
MENUITEM "&Rádios"
MENU
MENUITEM "Radio Tempo FM" action MudaRadioTV("Radio Tempo FM", oDlg, oActiveX)
MENUITEM "Radio Jovempan" action MudaRadioTV("Radio Jovempan (Campinas)", oDlg, oActiveX)
MENUITEM "Radio FM93" action MudaRadioTV("Radio FM93", oDlg, oActiveX)
MENUITEM "Radio Canção Nova" action MudaRadioTV("Radio Canção Nova", oDlg, oActiveX)
MENUITEM "Radio V.Mares AM" action MudaRadioTV("Radio Verdes Mares", oDlg, oActiveX)
ENDMENU
MENUITEM "&Tvs"
MENU
MENUITEM "Tv Canção Nova" action MudaRadioTV("Tv Canção Nova", oDlg, oActiveX)
MENUITEM "&Tv Internacional"
MENU
MENUITEM "Tv Rai News (Italia)" action MudaRadioTV("Tv Rai News (Italia)", oDlg, oActiveX)
MENUITEM "Tv CM (Argentina)" action MudaRadioTV("Tv CM (Musica Argentina)", oDlg, oActiveX)
MENUITEM "Knesset TV (Israel)" action MudaRadioTV("Knesset TV (Israel)", oDlg, oActiveX)
ENDMENU
ENDMENU
ENDMENU
oDlg:setmenu(oMenu)
RETURN oMenu
*-----------------------------------------------------------------------------
Function MudaRadioTV(cTitle, oDlg, oActiveX)
Local cFile, cString
oActiveX:DO( "Stop" )
If cTitle = "Radio Tempo FM"
oActiveX:SetProp( "FileName", "http://www.tempofm.com.br/tempofm3.asx", "Radio Tempo FM" )
ElseIf cTitle = "Radio Jovempan (Campinas)"
oActiveX:SetProp( "FileName", "http://www.dnip.com.br/link/jovempancampinas.wmx" )
ElseIf cTitle = "Radio Canção Nova"
oActiveX:SetProp( "FileName", "http://www.cancaonova.com/radiofm.asx" )
ElseIf cTitle = "Tv Canção Nova"
oActiveX:SetProp( "FileName", "http://www.cancaonova.com/tvcn.asx" )
ElseIf cTitle = "Tv Rai News (Italia)"
oActiveX:SetProp( "FileName", "http://mediapolis.rai.it/relinker/relinkerServlet.htm?cont=1" )
ElseIf cTitle = "Radio Verdes Mares"
oActiveX:SetProp( "FileName", "http://187.110.226.22:8122" )
ElseIf cTitle = "Tv CM (Musica Argentina)"
oActiveX:SetProp( "FileName", "mms://www.cmtv.com.ar:1234" )
ElseIf cTitle = "Radio FM93"
oActiveX:SetProp( "FileName", "http://187.110.226.22:8036")
ElseIf cTitle = "Knesset TV (Israel)"
oActiveX:SetProp( "FileName", "http://www.knesset.gov.il/broadcast/live.asx")
ElseIf cTitle = "Escolher Arquivo"
cString := "wav|*.wav|mp4|*.mp4|*.*|*.*|"
cFile := cGetFile( cString, "Selecione um arquivo",, CurDrive()+":\"+GetCurDir() )
If "*"$cFile .or. !File(cFile)
cFile:=""
Else
oActiveX:SetProp( "FileName", cFile )
Endif
Endif
Return nil
*---------------------------------------------------------------------------
Function PlayVideo()
local oDlg
Private oActiveX
VideoPath:=AllTrim(UBICACION)+AllTrim(NOMBRE)+'.'+EXT
If !File(VideoPath)
MsgAlert("No existe el video","Lo siento")
Return
Endif
DEFINE DIALOG oDlg TITLE UPPER(NOMBRE) STYLE WS_POPUP; oDlg:lHelpIcon := .F.
ACTIVATE DIALOG oDlg ON INIT MuestraVIDEO( oDlg ) VALID (oActiveX:controls:Stop(),.T. )
Return nil
*
Function MuestraVIDEO( oDlg )
oActiveX = TActiveX():New( oDlg, "WMPlayer.OCX.7" )
__KeyBoard(chr(13))
oDlg:oClient = oActiveX
oDlg:Maximize()
oActiveX:Settings:Volume = 100
oActiveX:url = VideoPath
oActiveX:StretchToFit = .T.
While oActiveX:Playstate != 1
SysRefresh()
If Lastkey()=27
Exit
Endif
End
oActiveX:End();oActiveX:Controls:Stop();oDlg:End()
Return nil
function OTRODIALOGO()
Local oActiveX
local oDlg, oFont3, oFont4, lOk := .F.
local oImageInicia
local aItems := { { " 01", " C01 - Leandro Arevalo "},;
{ " 02", " C02 - Lucio Camargo" },;
{ " 02", " A01 - Ivancho" } }
VideoPath:="C:\cartera\res\uno.mp4"
If !File(VideoPath)
MsgAlert("No existe el video","Lo siento")
Return
Endif
vGCed := Space( 18 )
vGMan := Space( 3 )
vGLot := Space( 2 )
DEFINE FONT oFont3 NAME "Segoe UI" SIZE 0, -25
DEFINE FONT oFont4 NAME "Segoe UI" SIZE 0, -50
DEFINE FONT oFontT NAME "Lucida Calligraphy" SIZE 0, -60 BOLD
DEFINE BRUSH oFondo FILE "C:\Cartera\Res\desert.BMP" STRETCH
DEFINE DIALOG oDlg STYLE nOr( WS_CHILD, WS_POPUP ) ;
SIZE ScreenWidth(), ScreenHeight() ;
BRUSH oFondo TRANSPARENT //COLOR CLR_WHITE, CLR_DIALOGS
@ 25, 500 SAY "Ciudadela La Bendicion" FONT oFontT COLOR CLR_BLUE, CLR_WHITE ;
OF oDlg TRANSPARENT PIXEL
@ 80, ScreenWidth()/3 XBROWSE oBrw ARRAY aItems COLSIZES 800 CELL ;
FONT oFontMed SIZE 300, 400 NOBORDER PIXEL OF oDlg
// oBrw:nDataLines = 2
oBrw:lRecordSelector = .F.
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
// oBrw:lHeader = .T.
oBrw:lHScroll = .F.
oBrw:lVScroll = .F.
// oBrw:nStretchCol = 1
oBrw:bClrStd = { || If( oBrw:nArrayAt % 2 == 0,;
{ CLR_BLACK, RGB( 0x33, 0x66, 0xCC ) },;
{ CLR_BLACK, RGB( 0x53, 0x86, 0xEC ) } ) }
oBrw:bClrSelFocus = { || { CLR_WHITE, RGB( 0x33, 0x33, 0x99 ) } }
oBrw:bClrSel = { || { CLR_WHITE, RGB( 0x13, 0x13, 0x79 ) } }
oBrw:SetColor( CLR_WHITE, RGB( 0x33, 0x66, 0xCC ) )
oBrw:CreateFromCode()
oBrw:SetArray( aItems )
oBrw:aCols[ 1 ]:cHeader := "Modulo"
oBrw:aCols[ 2 ]:cHeader := "Turno"
oBrw:SetFocus()
oDlg:bStart = { || MuestraVIDEO( oDlg ) }
ACTIVATE DIALOG oDlg CENTERED VALID (oActiveX:controls:Stop(),.T. )
return lOk
Function MuestraVIDEO( oDlg )
oActiveX = TActiveX():New( oDlg, "WMPlayer.OCX.7" , oDlg:nTop+160, oDlg:nLeft+80, oDlg:nRight-830, oDlg:nBottom-220)
oActiveX:Settings:Volume = 5
oActiveX:url = VideoPath
oActiveX:StretchToFit = .T.
While oActiveX:Playstate != 1
SysRefresh()
If Lastkey()=27
Exit
Endif
End
oActiveX:End();oActiveX:Controls:Stop();oDlg:End()
Return nil
Application
===========
Path and name: C:\CARTERA\PRG\monitor.exe (32 bits)
Size: 2,700,800 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150419)
FiveWin Version: FWHX 15.01
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 4 secs
Error occurred at: 03/01/16, 17:30:44
Error description: Error BASE/1004 Class: 'NIL' has no exported method: CONTROLS
Args:
[ 1] = U
Stack Calls
===========
Called from: => CONTROLS( 0 )
Called from: C:\CARTERA\PRG\monitor.prg => (b)OTRODIALOGO( 179 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:END( 518 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 419 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 906 )
Called from: => SYSREFRESH( 0 )
Called from: C:\CARTERA\PRG\monitor.prg => MUESTRAVIDEO( 189 )
Called from: C:\CARTERA\PRG\monitor.prg => (b)OTRODIALOGO( 177 )
Called from: .\source\classes\DIALOG.PRG => (b)TDIALOG:TDIALOG( 90 )
Called from: => TDIALOG:DISPLAY( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 893 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 286 )
Called from: C:\CARTERA\PRG\monitor.prg => OTRODIALOGO( 179 )
Called from: C:\CARTERA\PRG\monitor.prg => (b)MAIN( 72 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:LBUTTONDOWN( 2110 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1152 )
Called from: C:\CARTERA\PRG\monitor.prg => MAIN( 72 )
System
======
#Include "FiveWin.ch"
MEMVAR oActiveX, oDlgP
FUNCTION VIDEO()
DEFINE DIALOG oDlgP FROM 0,0 TO 300,300 PIXEL TITLE "teste" ;
COLORS CLR_BLACK, CLR_WHITE TRANSPARENT
oDlgP:bStart := {||PlayVideo() }
ACTIVATE DIALOG oDlgP CENTERED ;
VALID (oActiveX:controls:Stop(),.t.)
Return nil
Static Function PlayVideo()
oActiveX = TActiveX():New( oDlgP, "WMPlayer.OCX" )
__KeyBoard(chr(13))
oDlgP:oClient = oActiveX
oActiveX:Settings:Volume = 100
oActiveX:url ="FIVEWIN.avi" // "C:\MUSICA\audio1.mp3"
While oActiveX:Playstate != 1
SysRefresh()
If Lastkey()=27
Exit
Endif
EndDo
oDlgP:End()
Return nil
// FIN
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Julio Cepeda and 88 guests