HTML5 将 youtube 速度从 url 提高 2 倍? [英] HTML5 increase youtube speed 2x from url?

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

问题描述

我想知道如何在不点击(视频的)HTML5 的情况下将 youtube 视频加速 2 倍,而是通过修改 URL.

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.

例如,我知道如何通过将参数 &t=1m1s(持续 1 分 1 秒)附加到 URL 来观看从特定时间开始的视频.是否可以使用类似的方法将视频加速 2 倍?

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?

我应该在 URL 中添加哪些参数以双倍速度观看视频(我使用的是 html5)?

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

推荐答案

无法通过 URL 参数更改播放速度.

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

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

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

以下是使用所有 JavaScript 配置播放器的方法:https://developers.google.com/youtube/iframe_api_reference#Getting_Started

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

这是您正在寻找的用于设置播放速度的功能:https://developers.google.com/youtube/iframe_api_reference#Playback_rate

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

所以你可以像这样编辑你的 onPlayerReady 函数:

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();
}

您当然可以跳过文档的第 5 步,因为这会在 6 秒后停止播放您的视频.

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

如果您在设置时遇到问题,我稍后会编辑一个 JSFiddle(无法在工作中进行,因为我的 Flash 插件无法启动).

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).

这里的 JSFiddle 可以很好地处理这段代码:http://jsfiddle.net/jpreynat/e11oy0eu/

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

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

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