Change embedded player (player.md) quality and volume

Hi there!

I know this has been posted before, but all those topics are locked, and I was just wondering if maybe by now something to allow me to do the following things has been developed yet:

  1. I would like to be able to control the volume (e.g. from 0 to 1) of an embedded player with a command like player.setVolume(0.5);

  2. I would like to be able to control the quality (e.g. Mobile, High, Source) of an embedded player with a command like player.setQuality(‘Mobile’);

The latter seems to have been suggested in this topic as something that is already implemented, yet this command is not in the official player.md documentation on GitHub:

So was this command removed? Or was this user who posted this (last post in this topic) just making things up? Or am I not using it correctly? Right now, I’m doing:

player.loadStream(channel);
player.setQuality(‘Mobile’);

Thank you for your help!

Update:

It seems I got setQuality() to work by doing this before the loadStream() command.
Maybe setQuality should be added as possible functions to this page?

https://github.com/justintv/Twitch-API/blob/master/player.md

And please add volume control!

Thanks!

Actually… It seems the setQuality() only works if the video/stream has already started playing, so the only way to set a different quality (from what the user has saved as a cookie) is to do:

if(event.event == "videoPlaying") {
    var player = $("#twitch_embed_player")[0];
    <?php if(!empty($userdata["quality"])){ ?>
        player.setQuality('<?php echo($userdata["quality"]); ?>');
    <?php } else { ?>
        player.setQuality('Source');
    <?php } ?>
}

Sadly enough, no way (afaik) to set quality before the stream loads. At first I thought: OK not a big deal, we just load the “Low” quality first, and then upgrade if this is a saved user preference… But nope. Default is whatever the user selected last, there is no way to read this, and if it’s Source, the player will first load Source, and then downgrade (load again…).

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