Reputation: 33
i use this code for show youtube player in my website,
<iframe width="1920" height="1080" src="https://www.youtube.com/embed/ID?vq=hd1080&modestbranding=0&autoplay=1&cc_load_policy=1&fs=1&rel=0&showinfo=0&controls=2&autohide=0" frameborder="0" allowfullscreen></iframe>
I use "vq=hd1080" for play video with full-hd quality. But the quality of video when start is 720p. How can change the default quality(1080p) when video start?
Upvotes: 3
Views: 1003
Reputation: 8092
Try using player.setPlaybackQuality(suggestedQuality:String):Void
. This function sets the suggested video quality for the current video.
However, please note that if you set a suggestedQuality
level that is not available for the video, then the quality will be set to the next lowest level that is available. For example, if you request a quality level of hd1080
, and that is unavailable, then the playback quality will be set to hd720
. With this, you may want to first retrieve the actual video quality of the current video using player.getPlaybackQuality():String
.
And, based from this thread, you can only set the quality after the video has started playing.
Upvotes: 2