Skip to content

Commit 4ae3d90

Browse files
jason-cfharshil1712
authored andcommitted
Adding a new tutorial about AI Image generation. Updating the Stream … (#17601)
* Adding a new tutorial about AI Image generation. Updating the Stream component so it supports full URL thumbnails. Updating the parameter so it's intuitive. * code update
1 parent 3265f42 commit 4ae3d90

File tree

16 files changed

+69
-24
lines changed

16 files changed

+69
-24
lines changed

src/components/Stream.astro

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
interface Props {
33
videoId: string;
44
videoTitle: string;
5-
thumbnailStartTime: string;
5+
thumbnailTimeOrURL: string;
66
}
77
8-
const { videoId, videoTitle, thumbnailStartTime } = Astro.props;
8+
const { videoId, videoTitle, thumbnailTimeOrURL } = Astro.props;
99
1010
const customerId = "1mwganm1ma0xgnmj";
1111
const baseUrl = `https://customer-${customerId}.cloudflarestream.com/`;
@@ -14,11 +14,20 @@ const url = new URL(`${videoId}/iframe`, baseUrl);
1414
url.searchParams.set("preload", "true");
1515
url.searchParams.set("letterboxColor", "transparent");
1616
17-
const thumbnailUrl = new URL(`${videoId}/thumbnails/thumbnail.jpg`, baseUrl);
18-
thumbnailUrl.searchParams.set("fit", "crop");
19-
thumbnailUrl.searchParams.set("time", thumbnailStartTime);
2017
21-
url.searchParams.set("poster", encodeURI(thumbnailUrl.toString()));
18+
// full url option
19+
if (thumbnailTimeOrURL !== undefined) {
20+
if (!thumbnailTimeOrURL.startsWith("http")) {
21+
const thumbnailUrl = new URL(`${videoId}/thumbnails/thumbnail.jpg`, baseUrl);
22+
thumbnailUrl.searchParams.set("fit", "crop");
23+
thumbnailUrl.searchParams.set("time", thumbnailTimeOrURL);
24+
25+
url.searchParams.set("poster", encodeURI(thumbnailUrl.toString()));
26+
} else {
27+
url.searchParams.set("poster", thumbnailTimeOrURL);
28+
}
29+
}
30+
2231
---
2332

2433
<div style="position: relative; padding-top: 56.25%">
@@ -28,8 +37,9 @@ url.searchParams.set("poster", encodeURI(thumbnailUrl.toString()));
2837
allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;"
2938
allowfullscreen="true"
3039
title={videoTitle}
31-
id={videoId}></iframe>
40+
id={videoId}></iframe>
3241
</div>
42+
<a href="https://www.youtube.com/@CloudflareDevelopers" target="_blank">Watch more videos on our Developer Channel</a>
3343
<script is:inline src="https://embed.cloudflarestream.com/embed/sdk.latest.js"
3444
></script>
3545
<script is:inline define:vars={{ vidId: videoId, videoTitle }}>

src/content/docs/d1/tutorials/build-a-comments-api/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cd d1-example
4444
<Stream
4545
videoId="8d20dd6cf5679f3272ca44a9fa01728c"
4646
videoTitle="Build a Comments API with D1"
47-
thumbnailStartTime="22s"
47+
thumbnailTimeOrURL="22s"
4848
/>
4949

5050
## 1. Install Hono

src/content/docs/durable-objects/get-started/video-series/app-frontend.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1313
<Stream
1414
videoId="efc08fd03da0dfebd2e4402af519acb5"
1515
videoTitle="Building the App Frontend and UI"
16-
thumbnailStartTime="2.5s"
16+
thumbnailTimeOrURL="2.5s"
1717
/>
1818

1919
Now, we're moving to the frontend. In this video, we'll set up the frontend starter code (the starter code is located in the Veet GitHub repository), connect to Durable Objects using a call room ID, and display a local video preview.

src/content/docs/durable-objects/get-started/video-series/deploy-app.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1515
<Stream
1616
videoId="aaa652e0e05bc09ac35451d9cbd4b341"
1717
videoTitle="Deploy your Video Call app"
18-
thumbnailStartTime="2.5s"
18+
thumbnailTimeOrURL="2.5s"
1919
/>
2020

2121
We're almost done with the project, and in this video, we'll add the finishing touches. Learn how to handle call disconnections, wire up essential media controls like muting/unmuting and video toggling, and integrate a TURN server to ensure reliable connections even behind firewalls. By the end of this video, your app will be fully functional and ready for deployment.

src/content/docs/durable-objects/get-started/video-series/durable-objects.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1313
<Stream
1414
videoId="fe3a2f97642951e692e86b3af36a4251"
1515
videoTitle="What are Durable Objects?"
16-
thumbnailStartTime="2.5s"
16+
thumbnailTimeOrURL="2.5s"
1717
/>
1818

1919
In this video, we will show how Durable Objects work and start building a video call app together.

src/content/docs/durable-objects/get-started/video-series/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1313
<Stream
1414
videoId="558cdd841276a1aba1426af6293d6d15"
1515
videoTitle="Introduction to Durable Objects"
16-
thumbnailStartTime="2.5s"
16+
thumbnailTimeOrURL="2.5s"
1717
/>
1818

1919
In this episode, we will present an overview of the final project, discuss its underlying architecture, and access resources to set up the project locally.

src/content/docs/durable-objects/get-started/video-series/make-answer-webrtc-calls.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1313
<Stream
1414
videoId="3b3a88940d3b1c635dbb6df0516218ab"
1515
videoTitle="Make and Answer WebRTC calls"
16-
thumbnailStartTime="2.5s"
16+
thumbnailTimeOrURL="2.5s"
1717
/>
1818

1919
In this video, we'll build on the frontend we set up earlier by adding functionality for making and answering WebRTC video calls. You'll learn how to create peer-to-peer connections, handle ICE candidates, and seamlessly send and receive video streams between users.

src/content/docs/durable-objects/get-started/video-series/real-time-messaging.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1313
<Stream
1414
videoId="a02e5f9e58999d96c3ec9dbb0efb9707"
1515
videoTitle="Real-time messaging with WebSockets"
16-
thumbnailStartTime="2.5s"
16+
thumbnailTimeOrURL="2.5s"
1717
/>
1818

1919
Now, we'll take it a step further by enabling our server to receive and broadcast messages. In this video, you'll learn how to route and broadcast incoming messages from WebSocket connections and implement error handling such as closed WebSocket connections. By the end, you will have completed the backend for our video call app.

src/content/docs/durable-objects/get-started/video-series/serverless-websocket.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Details, DirectoryListing, Stream } from "~/components";
1313
<Stream
1414
videoId="86c64a50e0ea53dadd1ea1194bdeda92"
1515
videoTitle="Create a Serverless Websocket 'Backend'"
16-
thumbnailStartTime="2.5s"
16+
thumbnailTimeOrURL="2.5s"
1717
/>
1818

1919
In this video, we'll create a WebSocket backend using serverless technology, making the process simpler than ever before. You'll learn how to create your first Durable Object, set up a WebSocket server to coordinate connections, and keep track of connected clients.

src/content/docs/pages/framework-guides/deploy-a-hono-site.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,4 @@ For demo applications using Hono and Cloudflare Pages, refer to the following re
161161

162162
### Creator Interview
163163

164-
<Stream videoId="db240ef1d351915849151242ec0c5f1c" videoTitle="DevTalk Episode 01 Hono" thumbnailStartTime="5s" />
165-
[Watch more videos on our Developer Channel](https://www.youtube.com/@CloudflareDevelopers)
164+
<Stream videoId="db240ef1d351915849151242ec0c5f1c" videoTitle="DevTalk Episode 01 Hono" thumbnailTimeOrURL="5s" />

0 commit comments

Comments
 (0)