Skip to content

Commit 73f67b3

Browse files
committed
refactor: adjust example to match new screenshots resolver
1 parent 4b05c48 commit 73f67b3

File tree

1 file changed

+18
-8
lines changed
  • examples/using-gatsby-transformer-video/src/pages

1 file changed

+18
-8
lines changed

examples/using-gatsby-transformer-video/src/pages/index.js

+18-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function Video({
1212
previewWebP,
1313
previewGif,
1414
videoSepia,
15+
videoScreenshots,
1516
},
1617
...props
1718
}) {
@@ -20,9 +21,9 @@ function Video({
2021
<h2>Example: {name.substring(0, 1).toUpperCase() + name.substring(1)}</h2>
2122
<h3>Screenshots at 1s, 50% and 99%:</h3>
2223
<div className="screenshots">
23-
{videoH264.screenshots.map(({ path }) => (
24+
{videoScreenshots.map(({ publicURL }) => (
2425
<div key="path">
25-
<img src={path} />
26+
<img src={publicURL} />
2627
</div>
2728
))}
2829
</div>
@@ -39,12 +40,22 @@ function Video({
3940
<img loading="lazy" src={previewGif.path} alt="" />
4041
</picture>
4142
<h3>Video as optimized h264 &amp; h265:</h3>
42-
<video playsInline preload="auto" controls>
43+
<video
44+
playsInline
45+
preload="auto"
46+
poster={videoScreenshots[0].publicURL}
47+
controls
48+
>
4349
<source src={videoH265.path} type="video/mp4; codecs=hevc" />
4450
<source src={videoH264.path} type="video/mp4; codecs=avc1" />
4551
</video>
4652
<h3>Custom video converter:</h3>
47-
<video playsInline preload="auto" controls>
53+
<video
54+
playsInline
55+
preload="auto"
56+
poster={videoScreenshots[0].publicURL}
57+
controls
58+
>
4859
<source src={videoSepia.path} type="video/mp4; codecs=avc1" />
4960
</video>
5061
</div>
@@ -80,12 +91,8 @@ export const query = graphql`
8091
overlayX: "end"
8192
overlayY: "start"
8293
overlayPadding: 25
83-
screenshots: "1,50%,99%"
8494
) {
8595
path
86-
screenshots {
87-
path
88-
}
8996
}
9097
videoH265(
9198
overlay: "gatsby.png"
@@ -107,6 +114,9 @@ export const query = graphql`
107114
previewGif: videoGif(maxWidth: 300, fps: 4, duration: 2) {
108115
path
109116
}
117+
videoScreenshots(timestamps: ["1", "50%", "99%"]) {
118+
publicURL
119+
}
110120
}
111121
}
112122
}

0 commit comments

Comments
 (0)