Skip to content

Commit

Permalink
Add video time list
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Wang <jay@zijie.wang>
  • Loading branch information
xiaohk committed Feb 21, 2024
1 parent 0eff6f9 commit a1df0b2
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/components/article/article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
startLogoBlinkAnimation,
stopLogoAnimation
} from '../container-signal/container-signal';
import type { NightjarYoutube } from '../youtube/youtube';

import '../youtube/youtube';

Expand Down Expand Up @@ -98,6 +99,9 @@ export class FarsightArticle extends LitElement {
@state()
bibtexHovering = false;

@query('nightjar-youtube')
youtubeComponent: NightjarYoutube | null | undefined;

//==========================================================================||
// Lifecycle Methods ||
//==========================================================================||
Expand Down Expand Up @@ -293,18 +297,26 @@ export class FarsightArticle extends LitElement {
<p>${unsafeHTML(text.whereTo[2])}</p>
`;

// Demo video BlSFbGkOlHk
// <lite-youtube videoid="BlSFbGkOlHk">
// <a
// class="lite-youtube-fallback"
// href="https://www.youtube.com/watch?v=BlSFbGkOlHk"
// >
// Watch on YouTube
// </a>
// </lite-youtube>;
// Demo video
let videoTimeList = html``;
for (const time of text.youtubeTimes) {
videoTimeList = html`${videoTimeList}
<li
class="video-link"
@click=${() => this.youtubeComponent?.play(time.startTime)}
>
${time.name}
<small>${time.timestamp}</small>
</li> `;
}

const demoVideo = html`
<h2 id="youtube-video">Demo Video</h2>
<ul class="video-list">
${videoTimeList}
</ul>
<div class="youtube-video">
<nightjar-youtube
videoId="BlSFbGkOlHk"
Expand Down

0 comments on commit a1df0b2

Please sign in to comment.