0

The YouTube API v3 allows you to request information about a video, such as its title, description, etc.

Is there a way to determine whether the video supports HD resolution?

A workaround could be to look for a maxres thumbnail:

var checkURL = "https://www.googleapis.com/youtube/v3/videos?key=XYZ&part=snippet&fields=items(snippet(thumbnails))&id=" + uid;

$.getJSON(checkURL, function(data) {
  if (data.items.length > 0) {
    /* Verify this video is HD */
    if (data.items[0].snippet.thumbnails.maxres == undefined) {
      alert("This video does not support HD")
    }
  }
});

but is there a better approach?

Community
  • 1
  • 1
Stephen Lead
  • 1,904
  • 5
  • 23
  • 46

1 Answers1

3

You can check if a video supports HD by reading contentDetails.definition in a video resource:

string

Indicates whether the video is available in high definition (HD) or only in standard definition.

Valid values for this property are: hd, sd

Community
  • 1
  • 1
approxiblue
  • 6,982
  • 16
  • 51
  • 59