Update this in your client.lua
if (IsControlJustReleased(0, 38)) then
FreezeEntityPosition(ped, true)
SendNuiMessage({ open = true })
SetNuiFocus(true, true)
end
if (IsControlJustReleased(0, 194)) then
FreezeEntityPosition(ped, false)
SendNuiMessage({ open = false })
SetNuiFocus(false, false)
end
Update your HTML with the below code
<html>
<head>
<title>Your Video UI</title>
<style>
/* Initially hide the video */
video {
display: none;
}
</style>
</head>
<body>
<video id="myVideo" width="400" controls>
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML video.
</video>
<script type="text/javascript">
// Listen for messages from client-side Lua
window.addEventListener('message', function(event) {
let data = event.data;
if (data.open === true) {
// Show the video element
document.getElementById('myVideo').style.display = 'block';
} else if (data.open === false) {
// Hide the video element
document.getElementById('myVideo').style.display = 'none';
}
});
</script>
</body>
</html>