【问题标题】:Custom the color of an youtube player embed自定义嵌入 youtube 播放器的颜色
【发布时间】:2019-09-28 12:39:36
【问题描述】:

对于某些项目,我想设置进度条的颜色或 youtube 播放器的播放按钮。

我知道我们可以通过在 src 中添加“?color=white”来设置为白色(默认为红色)。

但我想要更像“赫芬顿邮报”(法语版)视频嵌入:

https://www.huffingtonpost.fr/entry/en-australie-cette-tempete-de-sable-a-transforme-le-jour-en-nuit_fr_5cd302f0e4b07ce6ef795848

但是我在源代码中没有找到。 我尝试使用 JS 和 Jquery 在 iframe 中添加一个 css 文件(以更改规则颜色),但没有成功 ...

我应该怎么做?

谢谢!

【问题讨论】:

    标签: javascript css api youtube youtube-api


    【解决方案1】:

    这是 huffingtonpost.fr 特有的 YouTube 后端功能。原因如下:

    1. 打开https://www.huffingtonpost.fr/robots.txt(我们想要一个没有 CSS 和 JavaScript 的页面)
    2. 打开 DevTools 并选择 Elements 选项卡
    3. <body>的内容改为如下:

      <iframe id="ytplayer" type="text/html" allowfullscreen="allowFullScreen" src="https://www.youtube.com/embed/Hv_pklVVrQI" width="854" height="480" frameborder="0" allow="autoplay"></iframe>
      
    4. 您将看到绿色按钮和控件背景

    在所有其他域上,这将显示正常的“主题”。


    其他网站:


    仅适用于特定频道上传的视频。例子: https://ze.tt/oscarssomale-natalie-portman-feiert-alle-frauen-die-nicht-nominiert-wurden/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-03
      • 2013-09-19
      • 1970-01-01
      相关资源
      最近更新 更多