I did it this way
placed two buttons in the first DIV, then the video and with the JS I made a function passing as parameter to call the same ID, within the function I created a const video and put the oncontextmenu so the user can not download the video, then just put the querySelector calling the onclick with the attribute and ID, to this way pick up exactly what I want
<div>
<button wm-play="meuVideo">Play</button>
<button wm-pause="meuVideo">Pause</button>
</div>
<video id="meuVideo">
<source src="http://ovideoquevocequer/video.mp4" type="video/mp4">
</video>
<script>
function configurarVideo(id){
const video = document.getElementById(id)
video.oncontextmenu = () => false
document.querySelector(`[wm-play = ${id}]`).onclick = e => video.play()
document.querySelector(`[wm-pause = ${id}]`).onclick = e => video.pause()
}
configurarVideo('meuVideo')
</script>
I put it on top of the video player and when I click on it I want it to disappear and why I gave the play and when I click again that and pause I want it to show what I can implement to do this?
– Leonardo Costa
Leonardo Costa, you don’t need two
button
, just toggle the value according to the video status.– Tobias Mesquita
@Leonardocosta, now the example is complete, take a look.
– Tobias Mesquita
guy I think Voce did not mean I just want that when I click the button it disappear does not appear on the screen when der play not to disturb the video this button I will put on top of the video and when click on it or the video it will disappear for people watch the video without the button on faced in this example Voce gave he will continue on top so this time I just wanted him to hide-if when clicked can help Gradeco and thanks for the reply
– Leonardo Costa
@Leonardocosta, ready to go.
– Tobias Mesquita
blz worth I had managed before it was only by the onclick but it was worth even so only that it has a problem as I make it appear again if I click on the image or the own button of the player? i only added this in the input: onclick="Document.getElementById('button').style.display = 'None';"
– Leonardo Costa
@Leonardocosta for that I put in the event
pause
andended
video, so that whenever the video stops the buttonplay
reappear– Tobias Mesquita
intendi worked out thanks
– Leonardo Costa