mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: allows youtube embeds to respect the t
param (#21295)
This commit is contained in:
@ -4,7 +4,11 @@ export default class LazyVideo extends Component {
|
||||
get iframeSrc() {
|
||||
switch (this.args.providerName) {
|
||||
case "youtube":
|
||||
return `https://www.youtube.com/embed/${this.args.videoId}?autoplay=1`;
|
||||
let url = `https://www.youtube.com/embed/${this.args.videoId}?autoplay=1`;
|
||||
if (this.args.startTime > 0) {
|
||||
url += `&start=${this.args.startTime}`;
|
||||
}
|
||||
return url;
|
||||
case "vimeo":
|
||||
return `https://player.vimeo.com/video/${this.args.videoId}${
|
||||
this.args.videoId.includes("?") ? "&" : "?"
|
||||
|
@ -6,6 +6,7 @@
|
||||
}}
|
||||
data-video-id={{@videoAttributes.id}}
|
||||
data-video-title={{@videoAttributes.title}}
|
||||
data-video-start-time={{@videoAttributes.startTime}}
|
||||
data-provider-name={{@videoAttributes.providerName}}
|
||||
>
|
||||
{{#if this.isLoaded}}
|
||||
@ -13,6 +14,7 @@
|
||||
@providerName={{@videoAttributes.providerName}}
|
||||
@title={{@videoAttributes.title}}
|
||||
@videoId={{@videoAttributes.id}}
|
||||
@startTime={{@videoAttributes.startTime}}
|
||||
/>
|
||||
{{else}}
|
||||
<div
|
||||
|
@ -8,8 +8,9 @@ export default function getVideoAttributes(cooked) {
|
||||
const thumbnail = img?.getAttribute("src");
|
||||
const dominantColor = img?.dataset?.dominantColor;
|
||||
const title = cooked.dataset.videoTitle;
|
||||
const startTime = cooked.dataset.videoStartTime || 0;
|
||||
const providerName = cooked.dataset.providerName;
|
||||
const id = cooked.dataset.videoId;
|
||||
|
||||
return { url, thumbnail, title, providerName, id, dominantColor };
|
||||
return { url, thumbnail, title, providerName, id, dominantColor, startTime };
|
||||
}
|
||||
|
Reference in New Issue
Block a user