Hello. I create my firts script in FiveM. For some time trying to add video to this script.
I have only index.html , client.lua and server.lua
index.html
<html>
<head>
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
<style>
.general {display: none;}
.general2 {display: none;}
</style>
</head>
<body>
<div class="general">
<video width="640" height="360" loop autoplay>
<source src="https://www.youtube.com/watch?v=WoBh3hMWqlY">
</video>
</div>
<div class="general2">
<video width="640" height="360" loop autoplay>
<source src="https://www.youtube.com/watch?v=Lb1Gc8jiubc">
</video>
</div>
</body>
</html>
<style>
body {
width: 100%;
height: 100%;
border: none;
margin: 0px;
overflow: hidden;
}
video {
width: auto;
height: auto;
min-width: 100%;
min-height: 100%;
}
iframe {
width: 100%;
height: auto;
min-width: 100%;
min-height: 100%;
}
</style>
<script type="text/javascript">
$(function() {
/* open the UI for user */
window.addEventListener('message', function(event) {
if (event.data.type == "openGeneral"){
$('.general').css('display', 'block')
} else if (event.data.type == "closeAll"){
$('.general').css('display', 'none')
}
if (event.data.type == "openGeneral2"){
$('.general2').css('display', 'block')
} else if (event.data.type == "closeAll2"){
$('.general2').css('display', 'none')
}
});
});
</script>
I triggered video in client
SetNuiFocus(false,false)
SendNUIMessage({type = ‘openGeneral’})
But the movie is not showing. 0 error in F8 and console
thanks in advance