Webview and Youtube

Post Reply
vilian
Posts: 1068
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Webview and Youtube

Post by vilian »

Hi Guys,

I can show an youtube video in a dialog doing this:

Code: Select all | Expand

          oWebView = TWebView2():New( oDlg )
          oWebView:Navigate("https://youtu.be/3lgXBk-1SoQ")
          oWebView:Run()
How could I set youtube through webview2 to show this video in a Full Screen mode?
Sds,
Vilian F. Arraes
[email protected]
Belém-Pa-Brazil
User avatar
Lailton
Posts: 231
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil
Contact:

Re: Webview and Youtube

Post by Lailton »

try this one :D

Code: Select all | Expand

#include "FiveWin.ch"

#define GWL_STYLE         -16
#define HWND_TOP            0
#define SWP_NOOWNERZORDER 512
#define SWP_FRAMECHANGED   32

function Main()

	local oWebView

	oWebView := TWebView2():New()
	oWebView:Navigate( "https://www.youtube.com/watch?v=bX0YFNlYowQ" )

	setWebView2_fullscreen( oWebView )

	oWebView:Run()

return nil

function setWebView2_fullscreen( oWebView )

	local hWnd, aScreen, nStyle

	if hb_isObject( oWebView )

		hWnd := oWebView:GetWindow()
		aScreen := FW_GetMonitor( hWnd )

		if len( aScreen ) >= 4
			nStyle := GetWindowLong( hWnd, GWL_STYLE )
			nStyle := nAnd( nStyle, nNot( WS_OVERLAPPEDWINDOW ) )
			SetWindowLong( hWnd, GWL_STYLE, nStyle )
			SetWindowPos( hWnd, HWND_TOP, aScreen[ 1 ], aScreen[ 2 ], aScreen[ 4 ], aScreen[ 3 ], SWP_NOOWNERZORDER + SWP_FRAMECHANGED )
		endif

	endif

return nil
Regards,
Lailton Fernando Mariano
User avatar
Giovany Vecchi
Posts: 244
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Webview and Youtube

Post by Giovany Vecchi »

vilian
Posts: 1068
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Webview and Youtube

Post by vilian »

Thank you guys ;)
I solved this just using an youtube embed link.

Code: Select all | Expand

oWebView = TWebView2():New( Op )
oWebView:Navigate("https://www.youtube.com/embed/3lgXBk-1SoQ")
oWebView:Run()
Sds,
Vilian F. Arraes
[email protected]
Belém-Pa-Brazil
Post Reply