Fancybox YouTube

发布于 2025-01-04 15:25:00 字数 98 浏览 2 评论 0原文

我正在尝试让一个 fancybox YouTube 视频开始播放大约 12 分钟的视频。有人可以帮助我实现这一目标吗?无论我尝试什么,由于我是新手,我都无法让视频从我想要的地方开始。

I am trying to get a fancybox YouTube video to start about 12 minutes into a video. Can someone help me with achieving this? No matter what I have tried, since I am a novice, I cannot get the video to start where I want it to.

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

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

发布评论

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

评论(2

挽手叙旧 2025-01-11 15:25:00

我假设您已经设法在 fancybox 中显示视频,并且您只想选择 12 分钟的开始时间,不是吗?

如果是这样,请在 YouTube 视频的 URL 末尾添加 #t=12m00s (时间以分钟和秒为单位),就像

http://www.youtube.com/watch?v=JaFVr_cJJIY#t=12m00s

您也可以使用此格式一样

http://www.youtube.com/v/JaFVr_cJJIY&autoplay=1#t=12m00s

I assume that you have already managed to display the video in fancybox and you just you want to select the start time at 12 minutes, don't you?

If so, in the URL of the youtube video just add at the end #t=12m00s (time in minutes and seconds) like

http://www.youtube.com/watch?v=JaFVr_cJJIY#t=12m00s

you could also use this format

http://www.youtube.com/v/JaFVr_cJJIY&autoplay=1#t=12m00s
月光色 2025-01-11 15:25:00

如果您使用最新版本的 Fancybox (2+),YouTube 和 Vimeo 现在可以很好地识别和处理。

然而,由于大多数文档都在 Fancybox 1 上,因此需要进行一些挖掘才能找到这一点。Fancybox

会删除您的 YouTube URL 并添加一些默认参数:

  • autoplay=1(视频将自动播放)
  • autohide= 1(视频播放后控件将隐藏)
  • fs=1(启用全屏)
  • rel=0(隐藏相关视频)
  • hd= 1 (启用高清播放)
  • wmode=opaque(修复 YouTube 和灯箱的 z-index)
  • enablejsapi=1(启用 Javascript API)

这意味着通常您可以通过这些URL 中的参数并应用它们,但 Fancybox 2 会忽略这些参数并使用预设值。

不要沮丧!您可以覆盖脚本中的那些。几种方法。

普通媒体嵌入:

  $(".fancybox").fancybox({
      helpers : {
          media: true
      }
  });

自定义 URL 参数方法 1:

  $(".fancybox").fancybox({
      helpers : {
          media: {
              youtube : {
                  params : {
                      autoplay : 0
                  }
              }
          }
      }
  });

自定义 URL 参数方法 2:

  $(".fancybox").fancybox({,
       helpers : {
          media: true
      },
      youtube : {
          autoplay: 0
      }
  });

对于您的问题,您需要传入以下参数:

$ (".fancybox").fancybox({,
助手:{
媒体:真实
},
YouTube : {
开始: 720
}
});

If you're using the latest version of Fancybox (2+), YouTube and Vimeo are now recognized and handled quite well.

However, it took some digging around to find this out since most documentation is on Fancybox 1.

Fancybox strips your YouTube URL and adds some default parameters:

  • autoplay=1 (videos will autoplay)
  • autohide=1 (control will hide once video is playing)
  • fs=1 (fullscreen is enabled)
  • rel=0 (related videos are hidden)
  • hd=1 (HD playback is enabled)
  • wmode=opaque (fixes z-index with YouTube and lightboxes)
  • enablejsapi=1 (enables Javascript API)

What this means that normally you could pass those parameters in your URL and have them apply, but Fancybox 2 ignores those and falls back on the preset values.

Don't dismay! You can override those in your script. Several ways.

Normal media embed:

  $(".fancybox").fancybox({
      helpers : {
          media: true
      }
  });

Custom URL parameters method 1:

  $(".fancybox").fancybox({
      helpers : {
          media: {
              youtube : {
                  params : {
                      autoplay : 0
                  }
              }
          }
      }
  });

Custom URL parameters method 2:

  $(".fancybox").fancybox({,
       helpers : {
          media: true
      },
      youtube : {
          autoplay: 0
      }
  });

For your issue, you want to pass in this parameter:

$(".fancybox").fancybox({,
helpers : {
media: true
},
youtube : {
start: 720
}
});

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