File tree Expand file tree Collapse file tree 1 file changed +37
-6
lines changed Expand file tree Collapse file tree 1 file changed +37
-6
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- interface Props extends astroHTML .JSX .IframeHTMLAttributes {
2
+ interface Props extends Omit <astroHTML .JSX .IframeHTMLAttributes , ' src' | ' srcdoc' > {
3
+ /**
4
+ * Pass `true` to embed using `www.youtube.com` instead of `www.youtube-nocookie.com`
5
+ */
3
6
cookie? : boolean
7
+ /**
8
+ * YouTube IFrame Player API parameters
9
+ *
10
+ * Defaults to `{autoplay: 1}`, additional parameters will be merged into the defaults
11
+ * @see https://developers.google.com/youtube/player_parameters#Parameters
12
+ */
4
13
embedParams? : EmbedParams
14
+ /**
15
+ * `loading` attribute for the thumbnail `<img>`
16
+ *
17
+ * Defaults to `"lazy"`
18
+ */
19
+ loading? : ' eager' | ' lazy'
20
+ /**
21
+ * Thumbnail image to use in the static embed
22
+ *
23
+ * Defaults to `"default"`, pass 1, 2 or 3 to use a screenshot from the video instead.
24
+ */
5
25
thumbnail? : Thumbnail
26
+ /**
27
+ * Thumbnail resolution
28
+ *
29
+ * Defaults to `"sd"` (640x480)
30
+ */
6
31
thumbnailRes? : ThumbnailRes
32
+ /**
33
+ * Title for the static embed
34
+ */
7
35
title: string
36
+ /**
37
+ * 11-digit YouTube video id
38
+ */
8
39
videoId: string
9
40
}
10
41
@@ -77,13 +108,13 @@ let style = `<style>*{padding:0;margin:0;overflow:hidden}html,body{height:100%;b
77
108
let srcdoc = ` ${style }<a href="${embedUrl }"><img src="${thumbnailUrl }" alt="${title }" loading="${loading }"><div class="gradient"></div><div class="top"><div class="title">${title }</div></div><div class="button">${playButtonSvg }</div></a> `
78
109
---
79
110
<iframe
111
+ loading ={ loading }
112
+ src ={ embedUrl }
113
+ srcdoc ={ srcdoc }
114
+ title ={ title }
115
+ {... iframeAttributes }
80
116
allow =" accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
81
117
allowfullscreen
82
118
frameborder =" 0"
83
- loading ={ loading }
84
119
style =" width: 100%; aspect-ratio: 16/9;"
85
- title ={ title }
86
- {... iframeAttributes }
87
- src ={ embedUrl }
88
- srcdoc ={ srcdoc }
89
120
/>
You can’t perform that action at this time.
0 commit comments