@playpilot/tpi 8.33.0 → 8.33.2

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": "8.33.0",
3
+ "version": "8.33.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -66,3 +66,16 @@
66
66
  }
67
67
  }
68
68
  }
69
+
70
+ @mixin safari() {
71
+ @media not all and (min-resolution: 0.001dpcm) {
72
+ @supports (-webkit-appearance: none) {
73
+ @content;
74
+ }
75
+ }
76
+
77
+ @supports (hanging-punctuation: first) and (font: -apple-system-body) and
78
+ (-webkit-appearance: none) {
79
+ @content;
80
+ }
81
+ }
@@ -1,8 +1,9 @@
1
1
  <script lang="ts">
2
- import { getVideoId } from '$lib/trailer'
2
+ import { getVideoId, openTrailerOverlay } from '$lib/trailer'
3
3
  import { onMount } from 'svelte'
4
4
  import IconMute from './Icons/IconMute.svelte'
5
5
  import IconFullscreen from './Icons/IconFullscreen.svelte'
6
+ import type { TitleData } from '$lib/types/title'
6
7
 
7
8
  interface Props {
8
9
  embeddable_url: string
@@ -13,9 +14,10 @@
13
14
  autoplay?: boolean
14
15
  showActions?: boolean
15
16
  fallbackStartTime?: number
17
+ clickToPlay?: boolean
16
18
  }
17
19
 
18
- let { embeddable_url = '', controls = [], muted = false, loop = false, captions = false, autoplay = true, showActions = false, fallbackStartTime = 0 }: Props = $props()
20
+ let { embeddable_url = '', controls = [], muted = false, loop = false, captions = false, autoplay = true, showActions = false, fallbackStartTime = 0, clickToPlay = true }: Props = $props()
19
21
 
20
22
  const videoId = $derived(getVideoId(embeddable_url))
21
23
  const startTime = $derived((window?.PlayPilotLinkInjections?.video_playtimes?.[videoId || ''] || (fallbackStartTime + 1)) - 1)
@@ -51,7 +53,7 @@
51
53
  playsinline: true,
52
54
  autoplay,
53
55
  muted,
54
- clickToPlay: false,
56
+ clickToPlay,
55
57
  storage: { enabled: false },
56
58
  youtube: {
57
59
  noCookie: true,
@@ -93,6 +95,16 @@
93
95
  player.volume = state ? 0 : 1
94
96
  }
95
97
 
98
+ export function enterFullscreen(): void {
99
+ if (/iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) {
100
+ openTrailerOverlay({ embeddable_url } as TitleData)
101
+ toggleMute(true)
102
+ return
103
+ }
104
+
105
+ player.fullscreen.enter()
106
+ }
107
+
96
108
  export function play(event: CustomEvent): void {
97
109
  if (event.detail === embeddable_url) player?.play()
98
110
  }
@@ -120,7 +132,7 @@
120
132
  <IconMute {muted} />
121
133
  </button>
122
134
 
123
- <button class="action secondary" onclick={() => player.fullscreen.enter()} aria-label="Fullscreen">
135
+ <button class="action secondary" onclick={enterFullscreen} aria-label="Fullscreen">
124
136
  <IconFullscreen />
125
137
  </button>
126
138
  {/if}
@@ -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} fallbackStartTime={5} muted loop showActions />
18
+ <YouTubeEmbed {embeddable_url} {autoplay} fallbackStartTime={5} muted loop showActions clickToPlay={false} />
19
19
  </div>
20
20
 
21
21
  <style lang="scss">
@@ -9,9 +9,15 @@
9
9
  }
10
10
 
11
11
  const { embeddable_url = '', onclose }: Props = $props()
12
+
13
+ let windowHeight = $state(window.innerHeight)
14
+ let windowWidth = $state(window.innerWidth)
15
+ let portrait = $derived(windowWidth < windowHeight)
12
16
  </script>
13
17
 
14
- <div class="overlay" transition:fade={{ duration: 100 }}>
18
+ <svelte:window bind:innerWidth={windowWidth} bind:innerHeight={windowHeight} />
19
+
20
+ <div class="overlay" class:portrait transition:fade={{ duration: 100 }}>
15
21
  <YouTubeEmbed {embeddable_url} controls={['current-time', 'fullscreen', 'mute', 'play', 'progress']} />
16
22
 
17
23
  <!-- svelte-ignore a11y_click_events_have_key_events -->
@@ -41,12 +47,18 @@
41
47
  z-index: 1;
42
48
  position: relative;
43
49
  display: block;
44
- width: 95vmin;
50
+ width: 95vmax;
45
51
  height: auto;
52
+ max-height: 95vh;
46
53
  aspect-ratio: 16/9;
47
54
  box-shadow: 0 0 margin(4) rgba(255, 255, 255, 0.15);
48
55
  background: black;
49
56
  }
57
+
58
+ &.portrait :global(.plyr) {
59
+ width: 95vw;
60
+ height: auto;
61
+ }
50
62
  }
51
63
 
52
64
  .backdrop {
@@ -57,7 +57,7 @@ describe('YouTubeEmbed.svelte', () => {
57
57
  controls: ['play', 'mute', 'fullscreen', 'progress', 'current-time'],
58
58
  autoplay: true,
59
59
  muted: false,
60
- clickToPlay: false,
60
+ clickToPlay: true,
61
61
  playsinline: true,
62
62
  youtube: expect.objectContaining({ noCookie: true, cc_load_policy: 0, cc_lang_pref: 'auto' }),
63
63
  }),