@playpilot/tpi 8.23.0-beta.6 → 8.23.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editorial.mount.js +7 -7
- package/dist/link-injections.js +1 -1
- package/dist/mount.js +5 -5
- package/package.json +1 -1
- package/src/routes/components/YouTubeEmbed.svelte +3 -2
- package/src/routes/components/YouTubeEmbedBackground.svelte +1 -1
- package/src/tests/routes/components/YouTubeEmbed.test.js +6 -0
- package/src/tests/routes/components/YouTubeEmbedBackground.test.js +1 -1
package/package.json
CHANGED
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
captions?: boolean
|
|
12
12
|
autoplay?: boolean
|
|
13
13
|
showMuteControls?: boolean
|
|
14
|
+
fallbackStartTime?: number
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const { embeddable_url = '', controls = [], muted = false, loop = false, captions = false, autoplay = true, showMuteControls = false }: Props = $props()
|
|
17
|
+
const { embeddable_url = '', controls = [], muted = false, loop = false, captions = false, autoplay = true, showMuteControls = false, fallbackStartTime = 0 }: Props = $props()
|
|
17
18
|
|
|
18
19
|
const videoId = $derived(getVideoId(embeddable_url))
|
|
19
|
-
const startTime = $derived((window?.PlayPilotLinkInjections?.video_playtimes?.[videoId || ''] || 1) - 1)
|
|
20
|
+
const startTime = $derived((window?.PlayPilotLinkInjections?.video_playtimes?.[videoId || ''] || (fallbackStartTime + 1)) - 1)
|
|
20
21
|
const color = window?.getComputedStyle(document.body).getPropertyValue('--playpilot-primary')?.replace('#', '') || 'fa548a'
|
|
21
22
|
|
|
22
23
|
let iframe: HTMLIFrameElement | null = $state(null)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<div class="video-background" style="--height: {height}px; --width: {clientWidth}px;" bind:clientWidth bind:clientHeight data-testid="video-background">
|
|
18
|
-
<YouTubeEmbed {embeddable_url} {autoplay} muted loop showMuteControls />
|
|
18
|
+
<YouTubeEmbed {embeddable_url} {autoplay} fallbackStartTime={5} muted loop showMuteControls />
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
21
|
<style lang="scss">
|
|
@@ -46,6 +46,12 @@ describe('YouTubeEmbed.svelte', () => {
|
|
|
46
46
|
expect(/** @type {HTMLIFrameElement} */ (container.querySelector('iframe')).src).toContain('&autoplay=false')
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
+
it('Should start at given fallbackStartTime', () => {
|
|
50
|
+
const { container } = render(YouTubeEmbed, { embeddable_url: 'youtube.com/watch?v=abc', fallbackStartTime: 8 })
|
|
51
|
+
|
|
52
|
+
expect(/** @type {HTMLIFrameElement} */ (container.querySelector('iframe')).src).toContain('&start_time=8')
|
|
53
|
+
})
|
|
54
|
+
|
|
49
55
|
it('Should render error message if embeddable_url is invalid', () => {
|
|
50
56
|
const { container, getByText } = render(YouTubeEmbed, { embeddable_url: '-' })
|
|
51
57
|
|
|
@@ -8,6 +8,6 @@ describe('YouTubeEmbedBackground.svelte', () => {
|
|
|
8
8
|
const { container } = render(YouTubeEmbedBackground, { embeddable_url: 'youtube.com/watch?v=abc' })
|
|
9
9
|
|
|
10
10
|
// @ts-ignore
|
|
11
|
-
expect(container.querySelector('iframe').src).toBe('https://video.playpilot.net/?video_id=abc&color=fa548a&muted=true&loop=true&captions=false&controls=&start_time=
|
|
11
|
+
expect(container.querySelector('iframe').src).toBe('https://video.playpilot.net/?video_id=abc&color=fa548a&muted=true&loop=true&captions=false&controls=&start_time=5&autoplay=true&playsinline=true')
|
|
12
12
|
})
|
|
13
13
|
})
|