@playpilot/tpi 7.1.0 → 7.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -10,6 +10,7 @@
10
10
  const { embeddable_url = '', onclose }: Props = $props()
11
11
 
12
12
  const videoId = $derived(getVideoId(embeddable_url))
13
+ const color = window?.getComputedStyle(document.body).getPropertyValue('--playpilot-primary')?.replace('#', '') || 'fa548a'
13
14
 
14
15
  // Gets the YouTube ID from a url, can be a large number of different formats
15
16
  // https://stackoverflow.com/a/54200105/1665157
@@ -23,7 +24,7 @@
23
24
 
24
25
  <div class="overlay" transition:fade={{ duration: 100 }}>
25
26
  {#if videoId}
26
- <iframe width="600" height="338" src="https://www.youtube.com/embed/{videoId}?autoplay=true" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
27
+ <iframe width="600" height="338" src="https://video.playpilot.net/?video_id={videoId}&color={color}&autoplay=true&playsinline=true&controls=play,mute,fullscreen,progress,current-time" title="YouTube video player" frameborder="0" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
27
28
  {:else}
28
29
  Something went wrong
29
30
  {/if}
@@ -8,7 +8,7 @@ describe('YouTubeEmbedOverlay.svelte', () => {
8
8
  const { container } = render(YouTubeEmbedOverlay, { embeddable_url: 'youtube.com/watch?v=abc', onclose: () => null })
9
9
 
10
10
  // @ts-ignore
11
- expect(container.querySelector('iframe').src).toBe('https://www.youtube.com/embed/abc?autoplay=true')
11
+ expect(container.querySelector('iframe').src).toBe('https://video.playpilot.net/?video_id=abc&autoplay=true&playsinline=true&controls=play,mute,fullscreen,progress,current-time&color=#fa548a')
12
12
  })
13
13
 
14
14
  it('Should render error message if embeddable_url is invalid', () => {