First video is loaded in 1080p
than when I press a button with class="quality"
It should change the quality to 720p but it's not working in HTML5 player.
It works on Flash Player but not in HTML5. I'm using JavaScript Player API.
Note: None of these solutions worked for me. YouTube iFrame API "setPlaybackQuality" or "suggestedQuality" not working
function onPlayerReady(event) {
event.target.playVideo();
event.target.setPlaybackQuality('hd1080'); //works
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING) {
$(".quality").click(function() {
event.target.setPlaybackQuality('hd720'); //doesn't work
});
}
}
The problem is you can not downgrade quality. Once you set to 1080p for ex you can not go back to 720p.