diff --git a/.env.example b/.env.example index 954d52e..15455c7 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ VITE_PLAYER_URL="" +VITE_CONTENT_PLAYER_URL="" VITE_API_AUTH_URL="" VITE_APP_SECRET_KEY="" VITE_TELEMETRY_BASE_URL="" diff --git a/src/components/players/SunbirdPlayer.tsx b/src/components/players/SunbirdPlayer.tsx index e55910d..2a03596 100644 --- a/src/components/players/SunbirdPlayer.tsx +++ b/src/components/players/SunbirdPlayer.tsx @@ -4,9 +4,11 @@ import React, { useRef, useEffect } from "react"; import { handleEvent } from "../../pages/videos/utils"; const VITE_TELEMETRY_BASE_URL = import.meta.env.VITE_TELEMETRY_BASE_URL; const VITE_TELEMETRY_END_POINT = import.meta.env.VITE_TELEMETRY_END_POINT; +const VITE_PLAYER_URL = import.meta.env.VITE_PLAYER_URL; +const VITE_CONTENT_PLAYER_URL = import.meta.env.VITE_CONTENT_PLAYER_URL; interface SunbirdPlayerProps { - public_url: string; + public_url?: string; forwardedRef?: any; setTrackData?: (data: any) => void; width: number; @@ -38,6 +40,7 @@ const SunbirdPlayer = ({ const fileType = typeMatch ? typeMatch[1] : ""; let trackData: any[] = []; const [url, setUrl] = React.useState(""); + const [publicUrl, setPublicUrl] = React.useState(public_url || ""); useEffect(() => { if (iframeRef.current) { @@ -79,6 +82,7 @@ const SunbirdPlayer = ({ "video/x-youtube", ].includes(mimeType) ) { + setPublicUrl(VITE_CONTENT_PLAYER_URL || publicUrl); setUrl(`/content-player`); } }, [mimeType]); @@ -160,7 +164,9 @@ const SunbirdPlayer = ({ telemetryBaseUrl: VITE_TELEMETRY_BASE_URL || null, telemetryEndpoint: VITE_TELEMETRY_END_POINT || null, })} - src={`${public_url || process.env.PUBLIC_URL || ""}${url}/index.html`} + src={`${ + publicUrl || VITE_PLAYER_URL || process.env.PUBLIC_URL || "" + }${url}/index.html`} /> ); diff --git a/src/pages/videos/VideoReels.tsx b/src/pages/videos/VideoReels.tsx index 4608bf0..c7f7735 100644 --- a/src/pages/videos/VideoReels.tsx +++ b/src/pages/videos/VideoReels.tsx @@ -17,7 +17,6 @@ import SunbirdPlayer from "../../components/players/SunbirdPlayer"; import * as content from "../../services/content"; import IconByName from "../../components/common/icons/Icon"; import { handleEvent } from "./utils"; -const VITE_PLAYER_URL = import.meta.env.VITE_PLAYER_URL; const VideoItem: React.FC<{ id: string; @@ -81,7 +80,6 @@ const VideoItem: React.FC<{ firstName: localStorage.getItem("name"), lastName: "", }} - public_url={VITE_PLAYER_URL} /> {qml_id && (
@@ -99,7 +97,6 @@ const VideoItem: React.FC<{ firstName: localStorage.getItem("name"), lastName: "", }} - public_url={VITE_PLAYER_URL} />
)}