@TheIndra and this where ?
window.addEventListener("message", function(event) {
if (event.data.action == "play") {
document.getElementById("iframediv").src = "https://www.youtube.com/embed/" + event.data.video + "?autoplay=1"
}
})
Still didnt worked…
client.lua
function PlayYoutube(videoid)
SendNuiMessage({action = "play", video = videoid})
end
index.html
<html>
<head>
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="hide" style="display:none;">
<iframe id="frame" width="100%" height="100%" frameborder="0" allow="autoplay" allowfullscreen=""></iframe>
</div>
<script src="script.js" type="text/javascript"></script>
</body>
</html>
scripts.js
window.addEventListener("message", function(event) {
if (event.data.action == "play") {
document.getElementById("hide").style.display = "block";
document.getElementById("frame").src = "https://www.youtube.com/embed/" + event.data.video + "?autoplay=1"
}
})