YouTube iFrame API “setPlaybackQuality” or “suggestedQuality” not working

后端 未结 6 1095
温柔的废话
温柔的废话 2020-11-30 07:02

I\'m having some trouble setting the quality settings on a video via the Youtube iFrame API. This is my code:

var player;

player = new YT.Player(\'player\',         


        
6条回答
  •  野性不改
    2020-11-30 07:12

    another solution, stop video and use seekTo(). for live streaming you can skip seekTo(). The bad it will show buffering but the good is you have full control no matter what the player size.

    var player = YT.get('videoid');
    rate = 'small';
    var currentTime = player.getCurrentTime();
    player.stopVideo();
    player.setPlaybackQuality(rate);
    player.playVideo();
    player.seekTo(currentTime, false);
    

提交回复
热议问题