How to embed JavaScript script in front of ,</body> tag

It’s mainly this sentence, the previous ones are not a problem

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            const player = new Plyr('video');
        });
    </script>
</body >