There is no way to handle autoplay correctly. It's simply been broken for the past few years. There is also no way to detect autoplay using workarounds. I.e. autoplaying a silent audio, because you can only prove the existence of autoplay, but never its absence, since autoplay could be delayed for whatever reason and happen outside of your timeout based hack.