Skip to content

🎥 Make videos programmatically with React

location

Jonny Burger20d7fbfaaf4c
diff --git a/packages/bugs/api/location.ts b/packages/bugs/api/location.ts
index addcb35a25..0a2908b664 100644
--- a/packages/bugs/api/location.ts
+++ b/packages/bugs/api/location.ts
@@ -1,8 +1,10 @@
export default async function handler(request: Request) {
const country = request.headers.get('x-vercel-ip-country');
const city = request.headers.get('x-vercel-ip-city');
+ const latitude = request.headers.get('x-vercel-ip-latitude');
+ const longitude = request.headers.get('x-vercel-ip-longitude');
- return new Response(JSON.stringify({country, city}), {
+ return new Response(JSON.stringify({country, city, longitude, latitude}), {
status: 200,
headers: {
'access-control-allow-origin': '*',
diff --git a/packages/docs/src/remotion/HomepageVideo/Comp.tsx b/packages/docs/src/remotion/HomepageVideo/Comp.tsx
index b5f707490e..076626cef3 100644
--- a/packages/docs/src/remotion/HomepageVideo/Comp.tsx
+++ b/packages/docs/src/remotion/HomepageVideo/Comp.tsx
@@ -16,16 +16,21 @@ export type LocationAndTrending = {
};
export const getDataAndProps = async () => {
- const trending = await fetch('https://bugs.remotion.dev/trending')
+ const location = (await fetch(
+ 'https://bugs-git-homepage-player-remotion.vercel.app/api/location',
+ ).then((res) => res.json())) as Location;
+
+ const trending = await fetch(
+ 'https://bugs.remotion.dev/trending?lat=' +
+ location.lat +
+ '&lng=' +
+ location.lng,
+ )
.then((res) => res.json())
.then((data) => {
return {repos: data.repos.slice(0, 3), date: data.dateFetched};
});
- const location = (await fetch(
- 'https://bugs-git-homepage-player-remotion.vercel.app/api/location',
- ).then((res) => res.json())) as Location;
-
return {trending, location};
};