如何为YouTube视频播放器渲染播放率

发布于 2025-02-05 12:11:53 字数 726 浏览 4 评论 0 原文

我正在研究一个个人YouTube视频播放器项目,并且正在研究Cookpete的React-player。这是我引用的文件的链接:

这也是实际玩家: https://cookpete.com/reaect-player/

我正在尝试弄清楚如何在页面上渲染播放率。 cookpete包括三个按钮(1倍,1.5倍,2倍),它们会更改显示的播放率,但是如果您使用YouTube链接作为URL,并使用内置的YouTube栏更改速度,则速度呈现不会改变。

是否可以在页面上使用内置栏更新页面上的当前播放率?我相信YouTube Iframe API(player.getPlayBackrate())中有功能,但是由于我不使用iframe,我将如何集成此功能(也许是event.target.getplaybackrate())?我还看到了有关React Refs的一些事情,但不确定我在这里如何使用。

谢谢你的宝贵时间。我是React/API呼叫的新手,因此对任何帮助都非常感谢。

I am working on a personal YouTube video player project and am looking at cookpete's react-player. Here is the link to the file I am referencing: https://github.com/cookpete/react-player/blob/master/src/demo/App.js.

Here's the actual player as well: https://cookpete.com/react-player/.

I'm trying to figure out how to render the playback rate on the page. cookpete's includes three buttons (1x, 1.5x, 2x) that changes the playback rate displayed, but if you use a YouTube link as the URL and change the speed with the built-in YouTube bar, the speed rendered doesn't change.

Would it be possible to render the current playback rate on the page that updates with the built-in bar? I believe there a function in the YouTube iFrame API (player.getPlaybackRate()), but since I am not using iFrame, how would I integrate this (maybe event.target.getPlaybackRate())? I've also seen some things about React refs but not sure how I'd use here.

Thank you for your time. I am new to React/API calls, so any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文