DOM Exception

I am getting this error in while running the project in localhost, But not in server. Could you please tell me how to fix this issue?

DOMException: play() failed because the user didn’t interact with the document first.

You can find the full description by opening the provided link:

Did you actually read that link?