Ejecutar un video incrustado de yuotube con ActiveX

Ejecutar un video incrustado de yuotube con ActiveX

Postby hectorpapiri » Wed Dec 06, 2017 3:53 pm

¿ Alguien puede compilar este ejemplo y decirme porque da error ?

Code: Select all  Expand view

#include "fivewin.ch"

FUNCTION Ejemplo()
   local oWndChild, oActiveX
   local cFile, cPath, cHtml

   cHtml := ''
   cHtml += '<html>' + CRLF
   cHtml += '<body>' + CRLF
   cHtml += '<div id="vid" align="center">' + CRLF
   cHtml += '<iframe width="560" height="315" src="https://www.youtube.com/embed/i93Z7zljQ7I" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>' + CRLF
   cHtml += '</div>' + CRLF
   cHtml += '</body>' + CRLF
   cHtml += '</html>' + CRLF
   cHtml += CRLF

   cPath := cFilePath(GetModuleFileName(GetInstance()))
   cFile := cPath + "video.html"
   FErase(cFile)
   MemoWrit( cFile, cHtml )

   DEFINE WINDOW oWndChild TITLE "Video"
      oActiveX := TActiveX():New( oWndChild, "Shell.Explorer.2" )

      oWndChild:oClient := oActiveX
      oWndChild:Resize()

      oActiveX&#058;Do( "Navigate2", cFile )

   ACTIVATE WINDOW oWndChild

RETURN NIL
 


Saludos
hectorpapiri
 
Posts: 23
Joined: Wed Sep 14, 2016 7:13 pm
Location: Rosario, Santa Fe, Argentina

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby karinha » Wed Dec 06, 2017 6:13 pm

No me da error, mas no muestra el video.

Code: Select all  Expand view

#include "fivewin.ch"

FUNCTION Ejemplo()

   local oWndChild, oActiveX
   local cFile, cPath, cHtml

   cHtml := ''
   cHtml += '<html>' + CRLF
   cHtml += '<body>' + CRLF
   cHtml += '<div id="vid" align="center">' + CRLF
   cHtml += '<iframe width="560" height="315" src="https://www.youtube.com/embed/i93Z7zljQ7I" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>' + CRLF
   cHtml += '</div>' + CRLF
   cHtml += '</body>' + CRLF
   cHtml += '</html>' + CRLF
   cHtml += CRLF

   cPath := cFilePath(GetModuleFileName(GetInstance()))

   cFile := cPath + "video.html"

   FErase(cFile)
   MemoWrit( cFile, cHtml )

   DEFINE WINDOW oWndChild TITLE "Video"

      oActiveX := TActiveX():New( oWndChild, "Shell.Explorer.2" )

      oActivex&#058;Silent := .T.
      oActivex&#058;SetFocus()

      oWndChild:oClient := oActiveX
      oWndChild:Resize()

      oActiveX&#058;Do( "Navigate2", cFile )

   ACTIVATE WINDOW oWndChild

RETURN NIL
 


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7151
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby hectorpapiri » Wed Dec 06, 2017 7:18 pm

karinha wrote:No me da error, mas no muestra el video.

Code: Select all  Expand view

      oActivex&#058;Silent := .T.
      oActivex&#058;SetFocus()
 


Saludos.


Es que seguramente, "Silent" sea para silenciar los errores o mensajes, si lo ejecutas con shellexecute() se ve el video.
El problema está relacionado con javascript, como que no puede ejecutarlo.

Saludos
hectorpapiri
 
Posts: 23
Joined: Wed Sep 14, 2016 7:13 pm
Location: Rosario, Santa Fe, Argentina

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby karinha » Wed Dec 06, 2017 7:24 pm

Perfecto! Intenta ahora porfa!

Code: Select all  Expand view

#include "fivewin.ch"

STATIC oWnd

#define  HKEY_LOCAL_MACHINE      2147483650

FUNCTION Ejemplo()

   local oWndChild, oActiveX
   local cFile, cPath, cHtml

   cHtml := ''
   cHtml += '<html>' + CRLF
   cHtml += '<body>' + CRLF
   cHtml += '<div id="vid" align="center">' + CRLF
   cHtml += '<iframe width="560" height="315" src="https://www.youtube.com/embed/i93Z7zljQ7I" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>' + CRLF
   cHtml += '</div>' + CRLF
   cHtml += '</body>' + CRLF
   cHtml += '</html>' + CRLF
   cHtml += CRLF

   cPath := cFilePath(GetModuleFileName(GetInstance()))

   cFile := cPath + "video.html"

   FErase(cFile)
   MemoWrit( cFile, cHtml )

   /*
   http://fivewin.com.br/index.php?/topic/27339-problema-na-busca-do-cnpj-site-da-receita/

   http://forums.fivetechsupport.com/viewtopic.php?f=6&t=34901
   */

   INTER_APP_WEB_CONFIG("VIDEOAC.exe",11001)

   DEFINE WINDOW oWnd TITLE "Video"

   oActiveX := TActiveX():New( oWnd, "Shell.Explorer.2" )

   oActivex&#058;Silent := .T.
   oActivex&#058;SetFocus()

   oWnd:oClient := oActiveX
   oWnd:Resize()

   oActiveX&#058;Do( "Navigate2", cFile )

   ACTIVATE WINDOW oWnd

RETURN NIL
/*
Parametrize seu programa com a versão do seu navegador atual.

Ex: se seu navegador for iexplorer 11 coloque assim

INTER_APP_WEB_CONFIG("SeuPrograma.exe",11001)
*/


FUNCTION INTER_APP_WEB_CONFIG(f_cNameProg,f_nVersion_IE)

   Local oRegKey, cRegProgGet, lDeleteKey := .f.
 
   Default f_nVersion_IE := 11001

   if IsWow64()
   
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
      oRegKey:Set(f_cNameProg,f_nVersion_IE,4)
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_AJAX_CONNECTIONEVENTS" )
      oRegKey:Set(f_cNameProg,0,4)  // Padrão 0
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ZONE_ELEVATION" )
      oRegKey:Set(f_cNameProg,0,4)  // Padrão 1
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_READ_ZONE_STRINGS_FROM_REGISTRY" )
      oRegKey:Set(f_cNameProg,1,4)  // Padrão 0
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
      oRegKey:Set(f_cNameProg,1,4)
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
      oRegKey:Set(f_cNameProg,1,4)
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG" )
      oRegKey:Set(f_cNameProg,1,4) // Padrao 0
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" )
      oRegKey:Set(f_cNameProg,1,4) // Padrao 0
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_NINPUT_LEGACYMODE" )
      oRegKey:Set(f_cNameProg,0,4) // Padrao 1
      oRegKey:Close()


   Else

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
      oRegKey:Set(f_cNameProg,f_nVersion_IE,4)
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
      cRegProgGet := oRegKey:GetBinary(f_cNameProg)
      //? cRegProgGet
      If Empty(cRegProgGet)
        oRegKey:Set(f_cNameProg,1,4)
      EndIf
      oRegKey:Close()

      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE,;
           "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
        oRegKey:Set(f_cNameProg,1,4)
      oRegKey:Close()

   EndIf

RETURN NIL
 


Saludos cordiales desde Brasil.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7151
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby karinha » Wed Dec 06, 2017 7:44 pm

oActivex:Silent := .T.
oActivex:SetFocus()
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7151
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby hectorpapiri » Wed Dec 06, 2017 8:24 pm

karinha wrote:oActivex:Silent := .T.
oActivex:SetFocus()


Fantastico Joao, funciona a la perfección!

Gracias
hectorpapiri
 
Posts: 23
Joined: Wed Sep 14, 2016 7:13 pm
Location: Rosario, Santa Fe, Argentina

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby karinha » Thu Dec 07, 2017 6:23 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7151
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Ejecutar un video incrustado de yuotube con ActiveX

Postby karinha » Mon Dec 18, 2017 1:42 pm

// Very good, many thanks!

New Version:

Code: Select all  Expand view

// NOTE v8.prg

#include "FiveWin.ch"

#define  HKEY_LOCAL_MACHINE     2147483650

Function Main()

   Local oWnd, oBar, oFont, oActiveX, oCombo, nCombo := 1

   INTER_APP_WEB_CONFIG()

   DEFINE FONT oFont NAME "Arial" SIZE 0, -12

   DEFINE WINDOW oWnd TITLE "ISS live ustream TESTE"

   DEFINE BUTTONBAR oBar SIZE 33, 33 OF oWnd

   DEFINE BUTTON OF oBar FILE "..\bitmaps\window.bmp"  ;
          MESSAGE "ISS live ustream"                   ;
          ACTION ( oActiveX&#058;Do("Navigate2", Link(1) ), ;
                   oWnd:SetText("ISS live ustream"),   ;
                   oWnd:Refresh() )

   DEFINE BUTTON OF oBar FILE "..\bitmaps\window.bmp"  ;
          MESSAGE "ISS live ustream cam2"              ;
          ACTION ( oActiveX&#058;Do("Navigate2", Link(6)),  ;
                   oWnd:SetText("ISS live ustream"),   ;
                   oWnd:Refresh())

   DEFINE BUTTON OF oBar FILE "..\bitmaps\window.bmp"  ;
          MESSAGE "Tv Diário Ceará"                    ;
          ACTION ( oActiveX&#058;Do("Navigate2", Link(4)),  ;
                   oWnd:SetText("Tv Diário On line do Ceará-BR"), ;
                   oWnd:Refresh())

   DEFINE BUTTON OF oBar FILE "..\bitmaps\Exit.bmp"    ;
          MESSAGE "Sair" GROUP ACTION ( oWnd:End() )

   @ 0.5, 20 COMBOBOX oCombo VAR nCombo ;
      ITEMS { "ISS live ustream", "youtube1", "youtube2", "tv diario", ;
              "Escuta Aérea GALEÃO Rio", "ISS live ustream cam2" }     ;
      OF oBar SIZE 160, 200 FONT oFont                                 ;
      ON CHANGE (oActiveX&#058;Do("Navigate2", Link(nCombo)),               ;
      oWnd:SetText("stream No.: "+Alltrim(str(nCombo))), oWnd:Refresh())

   oActiveX := TActiveX():New( oWnd, "Shell.Explorer.2" )
   oActivex&#058;Silent := .t.
   oWnd:oClient := oActiveX

   SET MESSAGE OF oWnd TO FWVERSION NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd ON INIT oActiveX&#058;Do("Navigate2", Link(1))

   oFont:End()

Return nil
//------------------------------------------------------------------------------------
Function Link(nlink)

   Local cPath, cFile, cHtml := ''

   cPath := cFilePath(GetModuleFileName(GetInstance()))
   cFile := cPath + "v8.html"

   fErase(cFile)

   If nlink = 1
      cHtml := '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="100%" width="100%"><param name="wmode" value="transparent"> '+;
               '<param name="flashvars" value="cid=17074538&autoplay=true"><param name="allowfullscreen" value="true"> '+;
               '<param name="allowscriptaccess" value="always"><param name="src" value="http://www.ustream.tv/flash/viewer.swf"> '+;
               '<embed flashvars="cid=17074538&autoplay=true" allowfullscreen="true" allowscriptaccess="always" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash" height="100%" width="100%"></object>'
   Elseif nLink = 2
      cHtml := '<iframe width="100%" height="100%" src="https://www.youtube.com/embed/LcEE8gML8Lg?autoplay=1"></iframe>'
   ElseIf nLink = 3
      cHtml := '<iframe width="100%" height="100%" src="https://www.youtube.com/embed/lLuc6rtWkrM?autoplay=1"></iframe>'
   ElseIf nLink = 4
      cHtml := '<iframe allowfullscreen="true" msallowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" width="100%" height="100%" frameborder="0" src="http://fast.player.liquidplatform.com/pApiv2/embed/7a683b067e5eee5c8d45e1e1883f69b9?title=tvdiario&autoStart=true&enableShare=false&gaAccount=UA-24105952-6&alternateLive=http://slrp.sambavideos.sambatech.com/liveevent/tvdiario_7a683b067e5eee5c8d45e1e1883f69b9/livestream/playlist.m3u8" ></iframe>'
   ElseIf nLink = 5
      cHtml := '<H2>Escuta Aérea GALEÃO Rio'
      cHtml += '<iframe width="100%" height="100%" frameborder="0" src="http://radio.server6.com.br:8282/stream"></iframe>'
   Else
      cHtml += '<iframe width="100%" height="100%" src="http://www.ustream.tv/embed/9408562?html5ui&autoplay=true" scrolling="no" allowfullscreen webkitallowfullscreen frameborder="0" style="border: 0 none transparent;"></iframe>'
   Endif

   MemoWrit(cFile, cHtml)

Return cFile
//------------------------------------------------------------------------------------
Function INTER_APP_WEB_CONFIG(nVersionIE)

   Local oReg, oRegKey, cRegProgGet, lDeleteKey := .f., cNameProg, uIEver

   oReg := TReg32():New( HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Internet Explorer\" )

   uIEver := oReg:Get( "
svcVersion" )

   DEFAULT nVersionIE := If(Left(Alltrim(uIEver),2)="
11", 11001, )
   DEFAULT cNameProg  := Alltrim(cFileName(HB_ARGV(0)))

   If IsWow64()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
      oRegKey:Set(cNameProg, nVersionIE,4)
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_AJAX_CONNECTIONEVENTS" )
      oRegKey:Set(cNameProg,0,4)  // Padrão 0
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ZONE_ELEVATION" )
      oRegKey:Set(cNameProg,0,4)  // Padrão 1
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_READ_ZONE_STRINGS_FROM_REGISTRY" )
      oRegKey:Set(cNameProg,1,4)  // Padrão 0
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
      oRegKey:Set(cNameProg,1,4)
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
      oRegKey:Set(cNameProg,1,4)
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG" )
      oRegKey:Set(cNameProg,1,4) // Padrao 0
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING" )
      oRegKey:Set(cNameProg,1,4) // Padrao 0
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_NINPUT_LEGACYMODE" )
      oRegKey:Set(cNameProg,0,4) // Padrao 1
      oRegKey:Close()
   Else
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" )
      oRegKey:Set(cNameProg, nVersionIE,4)
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BEHAVIORS" )
      cRegProgGet := oRegKey:GetBinary(cNameProg)
      If Empty(cRegProgGet)
         oRegKey:Set(cNameProg,1,4)
      EndIf
      oRegKey:Close()
      oRegKey := TReg32():New( HKEY_LOCAL_MACHINE, "
SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_ENABLE_WEB_CONTROL_VISUALS" )
      oRegKey:Set(cNameProg,1,4)
      oRegKey:Close()
   EndIf

Return nil


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7151
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 7 guests