New workaround: Enabling autoplay for background videos on iOS

Hi everyone,
I’ve been doing a lot research about this issue and finally found a new workaround with jQuery that currently works for me:

<script>
(function($){
//PLAYS VIDEO IN LOW POWER MODE
$('video').addClass('inlinevideo');
$( document ).ready(function ()  {
  var videoElement = document.getElementsByClassName('inlinevideo');
  if (videoElement.playing) {}
  else {$('.inlinevideo').trigger('play');}});
})(jQuery);
</script>

I found the code here: FIX video background autoplay in iOS/MAC low power mode - Great-Tit - Web / Code / Design Magazine
Just changed $('body').on('click touchstart') to $( document ).ready()