If you write a code like above, it will solve all errors that you were facing. This code:
Adding muted resolves autoplay restrictions. The./ ensures the correct file path is used. Testing the file ensures it’s properly encoded.