diff --git a/public/dialogs/stefan.json b/public/dialogs/stefan.json index 484b1745bf957138fda9e1520c1b9ffb424c6d69..d7efb487917e12f51d0d3b3ba9e049a954bc24a7 100644 --- a/public/dialogs/stefan.json +++ b/public/dialogs/stefan.json @@ -56,6 +56,19 @@ "dap1question": { "text": "Ja, schon seit längerer Zeit und auch in diesem Semester wieder.", "addFacts": ["stefan/askedAfterDap1"], + "options": [ + { + "text": "Erzählen sie mir bitte mehr", + "linksToDialog": "showDap1Video" + }, + { + "text": "Interessant", + "linksToDialog": "start" + } + ] + }, + "showDap1Video": { + "peertubeVideoId": "56907252-8545-4bc3-89ed-a3fa2e3cf850", "options": [ { "text": "Interessant", diff --git a/src/SingleDialogComponent.svelte b/src/SingleDialogComponent.svelte index 154ae467e61617020662fde9af8f0d1a643f850f..c55da1e9d83b51abac3970f3b557ccb64f8c971e 100644 --- a/src/SingleDialogComponent.svelte +++ b/src/SingleDialogComponent.svelte @@ -7,6 +7,7 @@ const dispatch = createEventDispatcher(); export let imageUrl: string; + export let peertubeVideoId: string; export let title: string | undefined; export let text: string; export let options: DialogOption[] = []; @@ -72,8 +73,17 @@ </h3> {/if} -<img src={imageUrl} /> - +<img src={imageUrl} alt="Character you are talking to" /> +{#if typeof peertubeVideoId === "string" && peertubeVideoId.length > 0} + <iframe + title="Embedded video" + height="400" + sandbox="allow-same-origin allow-scripts allow-popups" + src="https://video.oh14.de/videos/embed/{peertubeVideoId}?autoplay=1&title=0&warningTitle=0&peertubeLink=0" + frameborder="0" + allowfullscreen + /> +{/if} <div> <Typewriter cascade interval={10} cursor={false}> {#each text.split("\n") as para} diff --git a/src/dialogSet.schema.json b/src/dialogSet.schema.json index bf7416d6eb6de64042d659824e06b43c720c0e23..7300f3c2997a6785177dca14f81d1e8393323da5 100644 --- a/src/dialogSet.schema.json +++ b/src/dialogSet.schema.json @@ -18,6 +18,10 @@ }, "type": "array" }, + "peertubeVideoId": { + "description": "Embeds a peerTube-Video into this dialog and plays it when the dialog is opened.", + "type": "string" + }, "imageUrl": { "description": "Can be used to overwrite imageUrl from DialogSet.\nE.g. when a different emotion should be shown for this dialog,", "type": "string" diff --git a/src/types.ts b/src/types.ts index fc40a9a63f4ef38b225b2606533555f610ba53ee..8009a7287c11280a14f97cd57940c84ba1ddabaf 100644 --- a/src/types.ts +++ b/src/types.ts @@ -45,6 +45,11 @@ export interface Dialog { * E.g. when a different emotion should be shown for this dialog, */ imageUrl?: string; + + /** + * Embeds a peerTube-Video into this dialog and plays it. + */ + peertubeVideoId?: string; /** * What the characters says to the player. * Line breaks (\n) are rendered as paragraphs.