Using setQuality for Interactive Frames for Live Streams - only “160p30”, “360p30”, “480p30”, “720p30” worked for me

I’m using the following code based on https://dev.twitch.tv/docs/embed/video-and-clips#interactive-frames-for-live-streams-and-vods to setQuality.

“160p30”, “360p30”, “480p30”, “720p30” all worked for me. But when I tried “1080p60 (Source)”, “1080p60”, “Source”, “1080p”, “720p60”, none of those worked. Probably I didn’t use the right string - which string should I use for 1080p to set the quality?.

Here is a list of qualities I got back for the stream:
get qualities: [{“group”:“auto”,“name”:“Auto”},{“name”:“1080p60 (source)”,“group”:“chunked”,“codecs”:“avc1.64002A,mp4a.40.2”,“bitrate”:6662256,“width”:1920,“height”:1080,“framerate”:60,“isDefault”:true,“bandwidth”:6662256},{“name”:“720p60”,“group”:“720p60”,“codecs”:“avc1.4D401F,mp4a.40.2”,“bitrate”:3257195,“width”:1280,“height”:720,“framerate”:60,“isDefault”:false,“bandwidth”:3257195},{“name”:“720p”,“group”:“720p30”,“codecs”:“avc1.4D401F,mp4a.40.2”,“bitrate”:2207195,“width”:1280,“height”:720,“framerate”:30,“isDefault”:false,“bandwidth”:2207195},{“name”:“480p”,“group”:“480p30”,“codecs”:“avc1.4D401F,mp4a.40.2”,“bitrate”:1262195,“width”:852,“height”:480,“framerate”:30,“isDefault”:false,“bandwidth”:1262195},{“name”:“360p”,“group”:“360p30”,“codecs”:“avc1.4D401F,mp4a.40.2”,“bitrate”:630000,“width”:640,“height”:360,“framerate”:30,“isDefault”:false,“bandwidth”:630000},{“name”:“160p”,“group”:“160p30”,“codecs”:“avc1.4D401F,mp4a.40.2”,“bitrate”:230000,“width”:284,“height”:160,“framerate”:30,“isDefault”:false,“bandwidth”:230000}]

Thanks for help.

<!-- Add a placeholder for the Twitch embed -->
<div id="twitchPlayer"></div>

<!-- Load the Twitch embed script -->
<script src= "https://player.twitch.tv/js/embed/v1.js"></script>

<!-- Create a Twitch.Embed object that will render within the "twitch-embed" root element. -->
<script type="text/javascript">
          var options = { 
            width: "100%", 
            height: "100%", 
            channel: <any live channel>, 
          }; 
          window.player = new Twitch.Player("twitchPlayer", options); 
          window.player.setQuality("480p");

</script>

Figured out the answer - replying here in case this is helpful to anyone that has the same question.

  • You can use “chunked” to set for 1080p.
  • “group” is one that specify the string to setQuality.
  • And you can get the qualities by listening to Twitch.Player.PLAYING event.

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