Re-initialize media player after refresh

<?php
add_action( 'facetwp_scripts', function() {
  ?>
    <script>
      document.addEventListener('facetwp-loaded', function() {
          if ( FWP.loaded ) {
              jQuery('.wp-audio-shortcode').mediaelementplayer();
          }
      });
    </script>
  <?php
}, 100 );