Page 1 of 1
Webview and Youtube
Posted: Mon Jul 07, 2025 6:34 pm
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?
Re: Webview and Youtube
Posted: Tue Jul 08, 2025 12:40 am
by Lailton
try this one
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
Re: Webview and Youtube
Posted: Tue Jul 08, 2025 10:54 am
by Giovany Vecchi
Re: Webview and Youtube
Posted: Tue Jul 08, 2025 11:18 am
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()