Issue when playing animation segments through javascript

<script>
  window.addEventListener("load", function() {
    const lottiePlayer = document.getElementById("Lottie");
    const lottie = lottiePlayer.getLottie();
    lottie.goToAndStop(48, true);

    const button = document.getElementById("button");
    button.addEventListener("click", function() {
      lottie.playSegments([48, 72], true);
    });
  });
</script>

Attaching a codesandbox for you to play with as well

Add the methods inside a DOM loaded event as well as add a second parameter to playSegments method as true. This is a frame=true flag which specifies that the provided array contains frames.

Hope this helps : )