Q:

unable to auto-play with mediaelement js in chrome

I am trying to autoplay audio from a live stream audio link: http://163.172.165.94:8728/;stream.mp3
I tried adding autoplay, and by doing:
$('#player2').mediaelementplayer({
    autoplay: true
});

nothing work, tried every single answer from stack overflow.
Can someone help me? What am I doing wrong?
<link rel="stylesheet" href="https://cdn.jsdelivr.net/mediaelement/latest/mediaelementplayer.css">

<div class="media-wrapper">
<audio id="player2" preload="auto" autoplay style="max-width:100%;">
<source src="http://163.172.165.94:8728/;stream.mp3" type="audio/mp3">
 </audio>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/mediaelement/latest/mediaelement-and-player.min.js"></script>
    <script>
    $('#player2').mediaelementplayer();
    </script>

A:

This will help you to auto play when it is loaded
<audio id="player2" preload="auto" autoplay style="max-width:100%;">
      <source src="<?php echo $audidec; ?>" type="audio/mp3">
</audio>

$('audio').mediaelementplayer({
    success: function (mediaElement) {
        mediaElement.play();
        mediaElement.addEventListener('ended', function (e) {
            alert("finished");
        }, true);
    }
});

