Reputation: 5197
I've read this document about controlling playback rate.
So I coded just like this in order to to implement.
However, it seems not working.
What's wrong with my code?
<script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer" };
swfobject.embedSWF("http://www.youtube.com/e/NQd6wX3hxZY?enablejsapi=1&playerapiid=ytplayer",
"ytapiplayer", "480", "270", "8", null, null, params, atts);
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
timerID = setInterval("getStatus()", 1);
}
</script>
<div id="ytapiplayer">...loading</div>
The button to change playBackrate
<button onclick="ytplayer.setPlaybackRate(2)">playbackRate+=0.1</button>
<button onclick="ytplayer.setPlaybackRate(0.25)">playbackRate-=0.1</button><br>
Upvotes: 2
Views: 679
Reputation: 15213
There is nothing wrong with your code. It is just that not all video's on youtube have the ability to play in more than one playbackrate. This video is one of them.
You can find out what playback rates the video has by calling ytplayer.getAvailablePlaybackRates()
.
https://developers.google.com/youtube/js_api_reference?hl=nl#getAvailablePlaybackRates
Upvotes: 1