Skip to content

Commit ae55d73

Browse files
KianNHkodster28
andauthored
[Docs Site] Render WebVTT transcripts in video catalog (#24105)
* [Docs Site] Render WebVTT transcripts in video catalog * unused import * tweak --------- Co-authored-by: kodster28 <[email protected]>
1 parent a44d79c commit ae55d73

File tree

2 files changed

+202
-7
lines changed

2 files changed

+202
-7
lines changed

src/content/stream/china-network-inside-china/index.yaml

Lines changed: 173 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,176 @@ products:
77
- china-network
88
thumbnail:
99
url: https://pub-d9bf66e086fb4b639107aa52105b49dd.r2.dev/1-China-network-thumbnail.png
10-
chapters: {
11-
"Introduction": "0s",
12-
"How does it work?": 50s,
13-
"ICP Regulations": 1m35s,
14-
"China Express": 2m
15-
}
10+
chapters:
11+
{
12+
"Introduction": "0s",
13+
"How does it work?": 50s,
14+
"ICP Regulations": 1m35s,
15+
"China Express": 2m,
16+
}
17+
transcript: |
18+
WEBVTT
19+
20+
1
21+
00:00:03.650 --> 00:00:08.210
22+
Do you have users in mainland China who are
23+
experiencing high latency accessing your
24+
25+
2
26+
00:00:08.210 --> 00:00:12.860
27+
services? Cloudflare China network solution
28+
can help you solve this easily.
29+
30+
3
31+
00:00:13.310 --> 00:00:18.530
32+
Hello, I'm Jess from Cloudflare here to teach
33+
you about our China network products.
34+
35+
4
36+
00:00:18.530 --> 00:00:23.780
37+
Sometimes when the internet users in mainland
38+
China visit your website on Cloudflare global
39+
40+
5
41+
00:00:23.780 --> 00:00:27.620
42+
network. They are connected to data centers
43+
outside of mainland China,
44+
45+
6
46+
00:00:27.620 --> 00:00:32.210
47+
and these longer distances will lead to high
48+
latency and low availability,
49+
50+
7
51+
00:00:32.210 --> 00:00:35.240
52+
creating a slow and poor user experience.
53+
54+
8
55+
00:00:35.510 --> 00:00:40.160
56+
We can speed up these web services easily
57+
with Cloudflare China network solution,
58+
59+
9
60+
00:00:40.160 --> 00:00:46.530
61+
with availability improving from 25% to 100%
62+
and response time speeding up from 300
63+
64+
10
65+
00:00:46.530 --> 00:00:49.040
66+
milliseconds to just 50 milliseconds.
67+
68+
11
69+
00:00:49.040 --> 00:00:55.160
70+
How first Cloudflare China network provides
71+
caching in mainland China through our partner
72+
73+
12
74+
00:00:55.190 --> 00:00:58.640
75+
JD cloud, with data centers in 34 cities.
76+
77+
13
78+
00:00:58.640 --> 00:01:03.530
79+
This means for your users in mainland China,
80+
their requests will go to the nearest data
81+
82+
14
83+
00:01:03.560 --> 00:01:08.570
84+
center inside of mainland China instead of
85+
any external Cloudflare data center.
86+
87+
15
88+
00:01:08.600 --> 00:01:11.870
89+
Shorter distance means faster content
90+
delivery.
91+
92+
16
93+
00:01:11.930 --> 00:01:15.980
94+
These data centers are fully integrated with
95+
Cloudflare global network.
96+
97+
17
98+
00:01:16.010 --> 00:01:22.050
99+
You'll have access to the same configuration
100+
tools for cache WAF origin rules and other
101+
102+
18
103+
00:01:22.050 --> 00:01:24.450
104+
settings, all within a single dashboard.
105+
106+
19
107+
00:01:24.960 --> 00:01:27.330
108+
The same goes for name servers in Mainland
109+
China.
110+
111+
20
112+
00:01:27.360 --> 00:01:30.840
113+
If the majority of your users are located
114+
within Mainland China,
115+
116+
21
117+
00:01:30.840 --> 00:01:35.910
118+
we offer the option of an Inchina name server
119+
that will help speed up DNS resolution.
120+
121+
22
122+
00:01:36.120 --> 00:01:41.070
123+
Second, the China network is designed to
124+
follow mainland China's ICP regulations.
125+
126+
23
127+
00:01:41.070 --> 00:01:46.020
128+
This means we can guarantee your web service
129+
will always remain accessible to users in
130+
131+
24
132+
00:01:46.050 --> 00:01:51.240
133+
mainland China, without interruptions from
134+
local internet service providers or ISPs.
135+
136+
25
137+
00:01:51.270 --> 00:01:55.500
138+
If you're not sure how ICP works,
139+
our China based partners can help you with
140+
141+
26
142+
00:01:55.500 --> 00:01:57.840
143+
the ICP filing and maintenance.
144+
145+
27
146+
00:01:57.870 --> 00:02:03.210
147+
Third, for dynamic content that cannot be
148+
cached in the data centers within mainland
149+
150+
28
151+
00:02:03.210 --> 00:02:09.300
152+
China, such as API calls or web apps,
153+
users may still experience increased latency
154+
155+
29
156+
00:02:09.300 --> 00:02:12.540
157+
if your origin is located outside of mainland
158+
China.
159+
160+
30
161+
00:02:12.540 --> 00:02:16.590
162+
So for these cases, we offer the option of
163+
China Express,
164+
165+
31
166+
00:02:16.590 --> 00:02:21.870
167+
which will accelerate both DNS resolution and
168+
traffic for origin content.
169+
170+
32
171+
00:02:21.900 --> 00:02:24.840
172+
Watch our video on China Express to learn
173+
more.
174+
175+
33
176+
00:02:24.870 --> 00:02:29.490
177+
Thus, the China network solutions sound like
178+
something that will help you reach out to our
179+
180+
34
181+
00:02:29.490 --> 00:02:30.870
182+
sales team to learn more.

src/pages/videos/[...slug].astro

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import StarlightPage, {
55
type StarlightPageProps,
66
} from "@astrojs/starlight/components/StarlightPage.astro";
77
8-
import { Stream, Width } from "~/components";
8+
import { Stream, Width, Details } from "~/components";
99
1010
export const getStaticPaths = (async () => {
1111
const entries = await getCollection("stream");
@@ -33,10 +33,38 @@ const props = {
3333
},
3434
hideBreadcrumbs: true,
3535
} as StarlightPageProps;
36+
37+
let parts;
38+
if (entry.transcript) {
39+
let replaced = entry.transcript.replace("WEBVTT", "");
40+
41+
replaced = replaced.replace(/.+ --> .+/g, "");
42+
replaced = replaced.replace(/<\/c>/g, "");
43+
replaced = replaced.replace(/<.+?>/g, "");
44+
replaced = replaced.replace(/^\s*$/g, "");
45+
replaced = replaced.replace(/&nbsp;/g, " ");
46+
47+
parts = replaced.split("\n\n");
48+
49+
parts = parts.map((line) => line.trim().replaceAll("\n", ""));
50+
parts = parts.filter(Boolean);
51+
parts = parts.filter((line) => !/\d/.test(line));
52+
parts = parts.filter((line, index, lines) => line !== lines[index + 1]);
53+
}
3654
---
3755

3856
<StarlightPage {...props}>
3957
<Width size="large" center={true}>
4058
<Stream id={entry.id} title={entry.title} chapters={entry.chapters} />
59+
{
60+
parts && (
61+
<br/>
62+
<Details header="Transcript">
63+
{parts.map((part) => (
64+
<p>{part}</p>
65+
))}
66+
</Details>
67+
)
68+
}
4169
</Width>
4270
</StarlightPage>

0 commit comments

Comments
 (0)