HTML5将youtube加速2倍于url? [英] HTML5 increase youtube speed 2x from url?

查看:211
本文介绍了HTML5将youtube加速2倍于url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在没有用户点击HTML5(视频)的情况下加速YouTube视频2倍,而是通过修改网址。



例如,我知道如何从特定时间开始观看视频,方法是在URL上追加参数& t = 1m1s (1分钟和1秒)。 是否可以使用类似的方法来加速视频2倍?



我应该将哪些参数添加到观看视频的网址为double速度(我使用html5)?

解决方案

无法通过网址参数更改播放速度。



无论如何,如果您使用的是HTML,您可以利用YouTube Player iFrame API。

以下是配置包含所有JavaScript的播放器:
https://developers.google.com/youtube/ iframe_api_reference#Getting_Started



以下是您要设置播放速度的功能:
https://developers.google.com/youtube/iframe_api_reference#Playback_rate



所以你可以编辑你的onPlay erReady函数是这样的:

  function onPlayerReady(event){
player.setPlaybackRate(2); //这是你正在寻找
event.target.playVideo();
}

您当然可以传递文档的第5步,因为这会阻止您6秒后播放视频。



如果您在设置时遇到问题,我稍后会编辑JSFiddle(由于我的Flash插件赢了,无法工作't推出)。



更新:



JSFiddle可以正常工作这段代码正好:
http://jsfiddle.net/jpreynat/e11oy0eu/


I would like to know how to speed up a youtube video 2x without the user clicking on the HTML5 (of the video), but instead by modifying the URL.

For example, I know how to watch video starting at a specific time by appending to the URL the parameter &t=1m1s (for 1 minute and one second). Is it possible to use a similar method to speed up the video 2x?

What parameters should I add to the URL to watch video in double speed (I'm using html5)?

解决方案

There's no way to change playback speed by URL arguments.

Anyway, if you're working with HTML, you can take advantage of the YouTube Player iFrame API.

Here's how to configure your player with all the JavaScript: https://developers.google.com/youtube/iframe_api_reference#Getting_Started

And here's the function you're looking for to set playback speed: https://developers.google.com/youtube/iframe_api_reference#Playback_rate

So you can edit your onPlayerReady function like this:

function onPlayerReady(event) {
  player.setPlaybackRate(2); // This is what you're looking for
  event.target.playVideo();
}

You can of course pass on step 5 of the documentation as this will stop your video from playing after six seconds.

If you have trouble setting that up, I'll edit a JSFiddle later (couldn't do it at work as my Flash plugin won't launch).

Update :

Here's the JSFiddle working fine with this code exactly: http://jsfiddle.net/jpreynat/e11oy0eu/

这篇关于HTML5将youtube加速2倍于url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆