How can I insert two videos with HTML next to each other and play them both at the same time?

Asked

Viewed 32 times

-2

<html>

    <body>
        <video>
            <source src="teste.mp4" type="video/mp4">
        </video>

        <video>
            <source src="teste.mp4" type="video/mp4">
        </video>
    </body>

</html>

1 answer

-2

Add an event in javascript, which activates the moment you clicked on one of the videos, and then, inside the event, you use the play() function to play the other video.

+/- thus:

let Videos = document.getElementsByTagName('video');

Videos.onClick(Videos.play());
<html>

    <body>
        <video>
            <source src="teste.mp4" type="video/mp4">
        </video>

        <video>
            <source src="teste.mp4" type="video/mp4">
        </video>
    </body>

</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.