SetVolume has no effect

Hi,

I’m trying to use the player features with the newest embed API (https://player.twitch.tv/js/embed/v1.js)
My code is basically the same as the example

function setupTwitchPlayer() {
    var options = {
      width: 1280,
      height: 720,
      channel: "BastiGHG"
      // parent: ["embed.example.com", "othersite.example.com"]
    };
    player = new Twitch.Player("twitch-container", options);
    player.setVolume(0.1);
  }

The call to player.setVolume has no effect in either firefox or chrome (only two I tested so far).
I also added a button to set the volume programatically at a later point (also after initial interaction as mentioned in player.setVolume(0.0) & player.setMuted(true) not working?) but it still doesn’t work.

Would be thankful for any help!

Bump

Please do not bump threads.

Please fix your api.

I don’t work for Twitch I cannot investigate/solve the problem. I just help look after the forums.

No one replied to your thread as they don’t have an answer, or there is no other information to add as you already linked a relevant thread with all the information we have

Sorry I can’t be of more use.

Every time I’ve tested SetVolume it has worked as expected, or as I have noted on the thread you linked or other similar threads. I can’t find a problem since browser interaction score gets in the way on other sites.

1 Like

So I went and built a quick test

https://twitch.extensions.barrycarlyon.co.uk/temp/player_test.html

Everything works as expected.

You’ll first need to hit “unmute” and then setVolume works

So the only fix you’ll need is

function setupTwitchPlayer() {
    var options = {
      width: 1280,
      height: 720,
      channel: "BastiGHG"
      // parent: ["embed.example.com", "othersite.example.com"]
    };
    player = new Twitch.Player("twitch-container", options);
    player.addEventListener(Twitch.Embed.VIDEO_READY, function() {
      player.setMuted(false);
      player.setVolume(0.1);
    });
  }

https://twitch.extensions.barrycarlyon.co.uk/temp/player_test.html?test=1

And then deal with the interaction score/autoplay blocker that browser have

1 Like

Sorry for misinterpreting your role here on the forums, it just looked to me like you were the only person on here attempting to solve the problems of the users/devs, so I assumed you work for twitch.

Thanks for the example. On Win10 Firefox 78 and Chrome 84 it unfortunately does not work for me.

For Chrome it starts to work after having started (and unmuted) the video manually (using the twitch UI) on the same URL once and then refreshing (testing after in incognito mode doesn’t work again) - might be related to Chrome’s media engagement index (https://developers.google.com/web/updates/2017/09/autoplay-policy-changes).
Firefox somehow does not unmute at all.
The youtube embed API manages to somehow handle these cases.
[edit: just saw you already mentioned the engagement index - would be nice if the twitch API could copy the magic that the youtube api is doing for making it work regardless]

YouTube is owned by Google.
Google owns Chrome

!!!CONSPIRACY!!!

To the best of my knowledge there is no way to trick the Engagement index. Because the defeats the purpose of the Engagement index

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.