MCPcopy Create free account
hub / github.com/FxEmbed/FxEmbed / getVideoTranscodeDomain

Function getVideoTranscodeDomain

packages/atmosphere/src/helpers/transcode.ts:2–13  ·  view source on GitHub ↗
(twitterId: string, domains: string[])

Source from the content-addressed store, hash-verified

1/** Pick a video transcode host from `domains` using a stable hash of `id` (Twitter snowflake). */
2export const getVideoTranscodeDomain = (twitterId: string, domains: string[]): string | null => {
3 if (domains.length === 0) {
4 return null;
5 }
6
7 let hash = 0;
8 for (let i = 0; i < twitterId.length; i++) {
9 const char = twitterId.charCodeAt(i);
10 hash = (hash << 5) - hash + char;
11 }
12 return domains[Math.abs(hash) % domains.length];
13};
14
15/** Pick a Bluesky-oriented transcode host from `domains` using a hash of `blueskyDid`. */
16export const getVideoTranscodeDomainBluesky = (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected