Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8843239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:10:16+00:00 2026-06-14T11:10:16+00:00

i get an empty array when i call the youtube getAvailableQualityLevels() function, but why?

  • 0

i get an empty array when i call the youtube getAvailableQualityLevels() function, but why?
The video has many quality-levels like 360p 480p … 720p

DEMO:
http://jsbin.com/eyexah/1/edit

YT API Doc https://developers.google.com/youtube/js_api_reference#GettingReference

CODE:

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<script type="text/javascript" language="javascript">
      var params = { allowScriptAccess: "always" };
      var atts = { id: "youtube_player" };
      swfobject.embedSWF('http://www.youtube.com/v/ZGx2WUbhnyM?enablejsapi=1&playerapiid=ytplayer&version=3',
                         'youtube',
                         '425',
                         '356',
                         '8',
                         null,
                         null,
                         params,
                         atts);

</script>
<script type="text/javascript" language="javascript">
function onYouTubePlayerReady()
{
    console.log('# onYouTubePlayerReady');
    var ytp = document.getElementById("youtube_player");
    var getQuali = ytp.getAvailableQualityLevels();
    console.log(getQuali);
};
</script>
</head>

<body>       
  <div id="youtube"></div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:10:18+00:00Added an answer on June 14, 2026 at 11:10 am

    This would work if the state would be playing (or 1).

    add a listener for onStateChange events in your onYouTubePlayerReady function:

    ytp.addEventListener('onStateChange', 'onPlayerStateChange');
    

    and add the onPlayerStateChange function, for example:

    function onPlayerStateChange(event)
    {
       var getQuali = ytp.getAvailableQualityLevels();
    }
    

    See a working example based on your code: http://jsbin.com/eyexah/6/edit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$(function() { setInterval(function() { $.get(refresh.php, function(result) { $('#response').empty() .hide() .html(result) $(#response).append(result) .fadeIn(slow); }); },
I want to return an array from a php function to my ajax call.
While generating an XML content, I get an empty node <node/> , and I
Whenever the tags argument is not empty I get a NotSupportedException: Local sequence cannot
$new = $this->memcache->get(posts); if(empty($new)){ // Get the new posts $new = Posts::getNow(10); // Save
I get the error Data Source cannot be empty. Use :memory: to open an
I need to get patch file for inital commit (which is not empty) for
If I pass an empty list into a JPA query, I get an error.
If I don't include the stdafx even in an empty .cpp, I get this
C# spec. allows you to call a function void foo(params int[] x) with zero

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.