Jump to content

Problem with onClientRender


Recommended Posts

Hey there, I have been scripting a cinema for myself, the problem is that it isn't showing the video, The video does not play on the screen, it just stays static, I do not see any errors in my code, what do you guys think I'm doing wrong?

Here you go, this is my client-sided code:

local ventanitaLinda = guiCreateWindow(281, 281, 484, 149, "YT", 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("onClientRender", root, webBrowserRender)
	end
end
addEventHandler("onClientBrowserCreated", webBrowser, fullscreen)
addEventHandler("onClientGUIClick",root,fullscreen)



function url()
guiSetVisible(ventanitaLinda,true)
showCursor( true )
guiSetInputEnabled( true )
end
addEvent("onAbrir", true)
addEventHandler("onAbrir", root, url)

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

Thanks for the help btw.

Link to comment
48 minutes ago, NeXuS™ said:

Did you try to render the image on your screen with dxDrawImage?

Well but that isn't the main problem as it seems to been working but the video isn't playing.

I guess you mean this part of the code right? 

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

 

Link to comment
29 minutes ago, NeXuS™ said:

So the whole video is not being played? Do you mean it's not getting updated on the 3D material? Try to render it on your screen by dxDrawImage.

I'm getting this problem, the video isn't even playing. can you please give me atleast one example about how should I use the dxDraw to render the image?

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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