Stream Player ignoring the play method even muted and no autoplay with iframe

I’m trying to play a video using the Stream player API from an iframe with autoplay removed and muted.
If I enable the autoplay then the video is played fine. However, I need to play the video even muted after some process in the code (in my case after a couple of seconds). But even receiving the events that the video can be played and so on when I execute the play method (even inside the canplay callback) the player somehow ignores the method and also it ignores the returns from the Promises (catch or the then).

In my local in rare cases, really rare, the video play after the canplay event is triggered. But under WordPress host, all tentatives doesn’t play at all.

<iframe id="intro-video" src="https://iframe.videodelivery.net/<VIDEO_ID>?muted=true&controls=false" 
        style="border: none;" height="720" width="1280" 
        allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;" 
        allowfullscreen="true">
</iframe>
<script>
    introVideoPlayer = Stream(document.getElementById('intro-video'))
    introVideoPlayer.muted = true;
            introVideoPlayer.addEventListener('playing', this.playingCallback = (e) => {
              console.log(" video is playing ");
            });

            introVideoPlayer.addEventListener('canplay', this.canPlayCallback = (e) => {
              console.log(" video can play ");
              introVideoPlayer.play().catch(() => {
                 console.log('playback failed, muting to try again');
                 introVideoPlayer.muted = true;
                 introVideoPlayer.play();
              })
            });
</script>

It may be worth trying the new version of Stream:

thank you for your reply.

However, I tried using the v2 forcing by the flag as shown but It doesn’t work still.
And even trying at the codepen demo https://codepen.io/cfzf/pen/NWbqLNz provided by that post if I add something like this:

   const introVideoPlayer = Stream(document.getElementById('intro-video'));
introVideoPlayer.muted = true;
introVideoPlayer.addEventListener('canplay', this.canPlayCallback = (e) => {
          console.log(" video can play ");
          introVideoPlayer.play();
        });
        
        setTimeout(() => {
          console.log(" video could play after 4 seconds ");
          introVideoPlayer.muted = true;
          introVideoPlayer.play();
        }, 4000);

And of course, adding the library:

<script src="https://embed.videodelivery.net/embed/sdk.latest.js"></script>

and adding the id to the iframe and removing the autoplay querystring and the parameter still doesn’t work.

In both cases it doesnt play: after the event canplay and after the timeout. No errors, no warnings, nothing.

And also in rare cases, the video starts to play automagically right after loading the page even not having the autoplay at all there.
Perhaps am I still missing something using v2 as well?

Thank you!

Hi! Any inputs on that? I’m still getting this issue.

The play method doesn’t work at all and also the toggle audio button that I created doesn’t enable always the audio after the click event. Sometimes it enables, sometimes it doesn’t. With no changesin the code.
The video starts to play with the autoplay flag in the iframe querystring but even if a couple of seconds after started to play the video if the user clicks on the audio toggle button (a custom one, I disabled the default controls of the iframe) sometimes the audio is enabled, sometimes it doesn’t. No errors, no warnings, nothing. How is it possible?

Just to summarize: I don’t want to use the default control interface (it doesn’t fit on our UI) and I need to control the play after few seconds and also I need the option to enable the audio after the user clicks on a customized audio toggle. At the moment it doesn’t work at all in a stable way.

I’m running out of options here.

Same issue i been facing, same code i have implementd and also the js is very latest as its shows by its name , still not working player.play() or player.pause()

We’re investigating this and will post an update later this week.