Skip to content

Commit

Permalink
Use cloudflarestream.com domain by default (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
third774 authored Apr 25, 2022
1 parent 31bca2f commit f9efbc0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/useIframeSrc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function useIframeSrc(
.join("&");

const iframeSrc = useMemo(
() => `https://iframe.videodelivery.net/${src}?${paramString}`,
() => `https://iframe.cloudflarestream.com/${src}?${paramString}`,
// we intentionally do NOT include paramString here because we want
// to avoid changing the URL when these options change. Changes to
// these options will instead be handled separately via the SDK.
Expand Down
3 changes: 2 additions & 1 deletion src/useStreamSDK.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState, useEffect } from "react";

const sdkScriptLocation = "https://embed.videodelivery.net/embed/sdk.latest.js";
const sdkScriptLocation =
"https://embed.cloudflarestream.com/embed/sdk.latest.js";

// This needs to be wrapped as such for two reasons:
// - Stream is a function, and useState invokes functions immediately and uses the return value.
Expand Down
5 changes: 4 additions & 1 deletion src/validSrcUrl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export function validSrcUrl(str: string) {
try {
const url = new URL(str);
return url.hostname.endsWith("videodelivery.net") || url.hostname.endsWith("cloudflarestream.com");
return (
url.hostname.endsWith("videodelivery.net") ||
url.hostname.endsWith("cloudflarestream.com")
);
} catch {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion stories/Stream.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const poster = () => {

const poster = text(
"poster",
"https://videodelivery.net/644822f93dcddab3e9441587d184ca2f/thumbnails/thumbnail.jpg?time=109s&height=1200"
"https://cloudflarestream.com/644822f93dcddab3e9441587d184ca2f/thumbnails/thumbnail.jpg?time=109s&height=1200"
);

return (
Expand Down

0 comments on commit f9efbc0

Please sign in to comment.