Jump to content

webBrowser y onClientPreRender


Recommended Posts

Buen día, he estado trabajando con este script para crear una ventana de youtube, el problema es que, por ahora, simplemente cuando ingreso el URL en la GUI, crea la pantalla de youtube pero no me reproduce el vídeo, osea, simplemente me lo está dejando estático, no lo reproduce, independientemente de cual sea el URL que coloque, alguien podría ser tan amable de decirme en donde me estoy equivocando? para saber que debo corregir. Agradezco de antemano la ayuda que me brinden.

Aquí está el código que he construido:

local ventanitaLinda = guiCreateWindow(281, 281, 484, 149, "Fish Cinema", false)


addEventHandler("onClientResourceStart", resourceRoot,
function ()
		guiWindowSetSizable(ventanitaLinda, false)
		guiSetVisible(ventanitaLinda,false)
		links = guiCreateEdit(117, 31, 353, 36, "", false,ventanitaLinda)
        guiWindowSetSizable(ventanitaLinda, false)
        guiSetAlpha(ventanitaLinda, 1.00)
		etiqueta= guiCreateLabel(42, 36, 139, 25, "Ingrese ID:", false,ventanitaLinda)
        btngo = guiCreateButton(10, 90, 191, 44, "Crear", false,ventanitaLinda)
        btncancel = guiCreateButton(274, 88, 191, 44, "Cancelar", false,ventanitaLinda)
		etiqueta2 = guiCreateLabel(224, 102, 31, 22, "O", false,ventanitaLinda)  
		guiSetVisible(ventanitaLinda,false)
		
end
)


function dxDrawImage3D(x,y,z,w,h,m,c,r,...)
    local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z
    return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c , ...)
end
 
local screenWidth, screenHeight = guiGetScreenSize()
local webBrowser = createBrowser(screenWidth, screenHeight, false, false)

function webBrowserRender()
local x, y = 110.7, 1024.15
dxDrawMaterialLine3D(x, y, 23.25, x, y, 14.75, webBrowser, 18.2, tocolor(255, 255, 255, 255), x, y+1, 19)
end

function fullscreen()
	local URLs = tostring(links)
	if source == btngo then
	loadBrowserURL(webBrowser, "https://www.youtube.com/embed/"..URLs.."?autoplay=1&iv_load_policy=3&enablejsapi=1&fs=0&theme=light")
	addEventHandler("onClientPreRender", root, webBrowserRender)
	end
end
addEventHandler("onClientBrowserCreated", webBrowser, fullscreen)
addEventHandler("onClientGUIClick",root,fullscreen)



function url()
guiSetVisible(ventanitaLinda,true)
showCursor( true )
guiSetInputEnabled( true )
end
addCommandHandler("cinema",url)

function closeman()
if source == btncancel then
guiSetVisible(ventanitaLinda,false)
showCursor( false )
guiSetInputEnabled(false)
end 
end
addEventHandler("onClientGUIClick",root,closeman) 

 

Edited by PezFenix2016
Link to comment

Ok, gracias por responder, lo he cambiado a onClientRender, pero el problema que tengo ahora es que, no me reproduce el video, es como si no leyera lo que tengo en la caja de texto... y encima, el debugscript 3 me tira un error:

Bad Usage @ "addEventHandler" ['OnClientRender' with this function is already handled]

No entiendo que está pasando aquí...

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...