如何链接没有字幕的 YouTube 视频?

发布于 2024-08-22 04:48:05 字数 610 浏览 11 评论 0原文

是否可以在 HTML 代码中链接 youtube 视频而不显示其字幕(字幕)?

假设我有以下视频: http://www.youtube.com/watch?v=kTvHIDKLFqc< /a> .它有默认的英文字幕。但是,当链接该视频时,我想在没有它们的情况下加载它。是否有可能通过视频中的某种参数来做到这一点?

我找到了此链接,其中包含说明去做,但似乎不起作用。如果我尝试使用以下格式的链接,它仍然会显示标题: http:// www.youtube.com/watch?v=kTvHIDKLFqc&cc_load_policy=0。是它不起作用还是我误解了什么?

Is it possible to link youtube videos in HTML code without showing it's captions (subtitles)?

Let's say I have following video: http://www.youtube.com/watch?v=kTvHIDKLFqc . It has default english subtitles. However, when linking this video, I want to load it without them. Is there a possibility to do so with some kind of parameter in video?

I found this link with description how to do it, but it doesn't seem to work. If I try to use following format of link, it shows captions anyway: http://www.youtube.com/watch?v=kTvHIDKLFqc&cc_load_policy=0. Is it not working or did I misunderstand anything?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

暖风昔人 2024-08-29 04:48:05

我发现文档有点误导,因为设置 &cc_load_policy=1 默认情况下不显示隐藏式字幕,但在输入时可以使用视频控制栏中的 cc 按钮进行切换,如下所示 -

http://www.google.com/support/youtube/bin/answer .py?hl=zh-CN&answer=140174

I found the documentation to be a little misleading in that setting &cc_load_policy=1 does not show the closed captions by default, but enables toggling with the cc button in the video control bar when entered as shown here -

http://www.google.com/support/youtube/bin/answer.py?hl=en&answer=140174

森林很绿却致人迷途 2024-08-29 04:48:05

看来 cc_load_policy 是一个只接受 1 作为值的参数,所以即使您尝试使用 0off > 值来关闭字幕,这不会产生任何影响(至少直到今天:2015-05-18 2017-09-11):
https://developers.google.com/youtube/player_parameters#cc_load_policy

2017-09 -11 解决方案:“启用隐私增强模式”

当您通过嵌入选项在 Youtube 中分享视频时,可以单击“启用隐私增强模式”复选框。这会将 URL 更改为不同的 Youtube 域https://www.youtube-nocookie.com

只要这样做,即使用户有字幕默认情况下,nocookie 选项将不会读取与用户首选项关联的 cookie(就好像用户默认情况下不需要字幕一样)。

我创建了这个 codepen 示例来解释这一点:

  1. 尝试播放“无参数”视频,然后播放 cc_load_policy=1 视频(由于用户偏好,它可能不会显示字幕,即使后者激活了 CC 按钮 - 红色下划线);
  2. 然后播放“nocookie domain”视频,应该没有字幕。
  3. 尝试激活“无参数”视频中的字幕并刷新页面。
  4. 除“nocookie 域”视频外的所有视频都将显示字幕。

免责声明:我只在 Chrome 中看到过这种情况(Firefox 和 Edge 总是在 nocookie 域中显示标题,即使在私人导航中也是如此)。如果您在“nocookie 域”视频中手动激活/停用字幕,则当​​您分别刷新页面时,它将显示/隐藏该域中的字幕。

老东西(视频所有者的部分解决方案)

cc_lang_pref 也不接受 offOff 作为值...

我设法将以这种方式关闭视频默认语言的字幕/字幕仅适用于 Safari 和 IE(我有默认语言和英语的字幕 - 就我而言,Chrome 和 Firefox 似乎忽略了更改,但我建议还是尝试一下):

  1. 在 YouTube 中,如果您转到视频的信息和设置页面并点击高级设置选项卡,请设置视频语言不适用
  2. 保存并转到字幕和 CC 页面,其中会出现一个弹出窗口,解释“您必须在添加字幕或 CC 之前选择视频语言。”(这似乎并不是真的,因为它们无论如何都会出现)。
  3. 在弹出窗口中选择视频的默认语言这样,当视频采用相同的默认语言时,它就会明白您不需要默认语言的字幕 奇怪的是,这一步会让他们不出现,而这并不是因为字幕中使用了相同的语言。
  4. 在您不希望有字幕的 URL 视频中,不要使用 cc_load_policy 参数,但您可以使用 cc_lang_pref 作为默认语言,如下所示:
    http://www.youtube.com/watch?v=kTvHIDKLFqc&cc_lang_pref= zh-cn

同样,这似乎仅在某些浏览器中有效(不包括 Firefox 和 Chrome),但希望它能有所帮助......

It seems cc_load_policy is a parameter that only accepts 1 as value, so even if you try to use 0 or off values to turn off captions, it won't make a difference (at least until today: 2015-05-18 2017-09-11):
https://developers.google.com/youtube/player_parameters#cc_load_policy

2017-09-11 Solution: "Enable privacy-enhanced mode"

When you share a video in Youtube through the embedding option, you can click the "Enable privacy-enhanced mode" checkbox. This will change the URL to a different Youtube domain: https://www.youtube-nocookie.com

Just by doing this, even if the user has captions On by default, the nocookie option will not read the cookie associated to the user preferences (it's as if the user does not require captions by default).

I have created this codepen example in order to explain this:

  1. Try playing the "No parameters" video and then the cc_load_policy=1 video (it may not display captions due to user preferences, even if in the latter the CC button is activated - red underline);
  2. Then play the "nocookie domain" video and there should be no captions.
  3. Try activating captions in the "no parameters" video and refresh the page.
  4. All videos except the "nocookie domain" video will display captions.

Disclaimer: I have only seen this working in Chrome (Firefox and Edge always display captions in the nocookie domain, even in private navigations). If you activate/deactivate captions manually in the "nocookie domain" video, then it will display/hide captions in this domain when you refresh the page respectively.

Old stuff (partial solution for owners of the video)

cc_lang_pref does not accept off or Off as a value either...

I managed to turn off captions/subtitles for the default language of the video this way only for Safari and IE (I have captions in the default language and English - in my case, Chrome and Firefox seemed to have ignored the change, but I suggest to give it a shot anyway):

  1. In youtube if you go to your video's Info and Settings page and click Advanced Settings tab, set the Video Language to Not applicable.
  2. Save and go to Subtitles and CC page, where a pop-up appears explaining that «You must select a video language before adding subtitles or CC.» (this seems not to be true, because they even appear anyway).
  3. Choose your video's default language in the pop-up: this is what makes it understand that you don't need captions of your default language when the video is in the same default language the weird thing is, this is the step that will make them not to show up, and it's not because the same language is used in the captions.
  4. In the URL's video that you do not want to have captions do not use cc_load_policy parameter, but you can use cc_lang_pref to the default language like this:
    http://www.youtube.com/watch?v=kTvHIDKLFqc&cc_lang_pref=en.

Again, this seems to work only in some browsers (Firefox and Chrome not included), but hope it helps...

_失温 2024-08-29 04:48:05

该网站说明了如何打开字幕。它没有谈论关闭字幕。我认为这取决于用户之前的选择。

当您将一个视频嵌入另一个视频时
网站,你可以制作这样的标题
始终显示在嵌入的
视频。启用视频字幕
您想嵌入,只需添加
&cc_load_policy=1 到视频的嵌入
代码。

The site says how to turn on caption. It does not talk about turning off captions. I thinkit depends on the user's previous choice.

When you embed a video on another
site, you can make it so that captions
are always shown on the embedded
video. To enable captions on a video
you'd like to embed, just add
&cc_load_policy=1 to the video's embed
code.

葬﹪忆之殇 2024-08-29 04:48:05

愿遵循指导的人平安,

(感谢您的尝试,但我在离那里不远的地方发现了一些不错的东西......)

要求不是来自翻译字幕的语言偏好(对于我的例子“他”代表希伯来语,即不在视频提供的翻译范围内。)

将 ?hl=He 添加到 URL,如下所示:

没有它:
https://www.youtube.com/watch?v=pRztmbnyV70

及其:
https://www.youtube.com/watch?v=pRztmbnyV70?hl=他

做到了...?
它在 Firefox、Edge 和 Opera 上对我有用。
- 享受 !

注意:页面加载后粒子消失......但是工作已经完成!

Peace to whom will follow the guidance,

(Thanks for your tries but I found something nice not far away from there...)

Ask for a language preference that is not from the translated captions (for my exemple "He" stands Hebrew, that was not among the offered translations of the video.)

Add ?hl=He to the url, like this :

without it :
https://www.youtube.com/watch?v=pRztmbnyV70

and with it :
https://www.youtube.com/watch?v=pRztmbnyV70?hl=He

Makes it... ?
It worked for me on Firefox, Edge and Opera.
-- Enjoy !

Note : the particle desapears after the loading of the page ...But the job is done !

路还长,别太狂 2024-08-29 04:48:05

非常简单,只需将 iv_load_policy=3 参数添加到您的嵌入代码中即可。

It's very simple, add iv_load_policy=3 parameter to your embed code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文