diff --git a/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-iframe.js b/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-iframe.js index 015e0ea521e..b75ad65fa66 100644 --- a/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-iframe.js +++ b/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-iframe.js @@ -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("?") ? "&" : "?" diff --git a/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.hbs b/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.hbs index b2f459a5288..0d0ae7138af 100644 --- a/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.hbs +++ b/plugins/discourse-lazy-videos/assets/javascripts/discourse/components/lazy-video.hbs @@ -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}}