【问题标题】:Youtube Video start time in iframe tagiframe 标记中的 Youtube 视频开始时间
【发布时间】:2021-09-17 01:05:55
【问题描述】:

我正在返回烧瓶中的字典列表:return render_template( "index.html" , data = data )

然后在 index.html 中循环遍历这个字典列表

{%for record in data%}
<p>{{record.video_id}} {{record.start_time}}</p>
{%endfor%} 

我在 html 中使用 iframe 来预览视频,并在特定的 start_time 像这样

{%for record in data%}
<iframe width="420" height="315"
src="https://www.youtube.com/embed/{{record.video_id}}?start={{record.start_time}}">
</iframe>

{%endfor%}

它显示视频正确,但开始时间不是那么如何在我给出的 start_time 变量的时间启用开始视频?

【问题讨论】:

  • It shows the videos right but the start time is not = edit 您对样本的问题。

标签: html flask iframe youtube jinja2


【解决方案1】:

您的链接生成器不正确,请将此模式用于 URL src="https://www.youtube.com/embed/{{record.video_id}}?t={{record.start_time}}m{{record.start_time}}s"&gt;

【讨论】:

  • 很抱歉让您感到困惑,我尝试了这个并且有效,src="youtube.com/embed/jRzPsloTDR4?start=399" 开始时间按视频分钟数乘以 60 秒计算,但简短的回答是在 Youtube 中打开您的视频并点击在分享按钮上,它会为您提供特定开始时间的链接
猜你喜欢
  • 2016-10-08
  • 1970-01-01
  • 2018-03-16
  • 2023-03-26
  • 2013-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-12
相关资源
最近更新 更多