I have an embedded YouTube video in one page and have a slider with which I can set the player speed.
I am using player.setPlaybackRate(value);
The problem is that I want ranges from 0.5 to 3, but the player API restricts the values only to predefined [0.25, 0.5, 1, 1.25, 1.5, 2]
.
In YouTube I can easily adjust the speed with document.getElementsByTagName("video")[0].playbackRate = 3
but on the iframe I do not have such access.
Where do you see that the player API restricts the values? In the javascript API, you can use setPlaybackRate to set the suggested playback rate, but it says there is no guarentee that what you send will be set. You should use getAvailablePlaybackRates to get the list of playback rates and then choose an appropriate one. You can figure out what rate it was actually set to by listening to the onPlaybackRateChangeevent. If you try to set it to 3 and that is not one of the available rates, it will round towards 1 to the closest rate.