Skip to content

Commit a006be5

Browse files
authored
fix: Fixes CldVideoPlayer not able to use PUBLIC_ env var (#90)
# Description PUBLIC_ was never exposed for CldVideoPlayer when the changes were previously made in: #82 ## Issue Ticket Number Fixes #89
1 parent c02a9ca commit a006be5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

svelte-cloudinary/src/lib/components/CldVideoPlayer.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import { loadCloudinary } from '$lib/util.js';
4646
import { checkCloudinaryCloudName } from '$lib/cloudinary.js';
4747
import { onMount } from 'svelte';
48+
import { env } from '$env/dynamic/public';
4849
4950
const idRef = Math.ceil(Math.random() * 100000);
5051
type $$Props = CldVideoPlayerProps;
@@ -146,11 +147,13 @@
146147
}
147148
148149
// Validation
149-
checkCloudinaryCloudName(import.meta.env.VITE_PUBLIC_CLOUDINARY_CLOUD_NAME);
150+
const cloudName = env.PUBLIC_CLOUDINARY_CLOUD_NAME || import.meta.env.VITE_PUBLIC_CLOUDINARY_CLOUD_NAME;
151+
152+
checkCloudinaryCloudName(cloudName);
150153
151154
let playerOptions: CloudinaryVideoPlayerOptions = {
152155
autoplayMode: autoPlay,
153-
cloud_name: import.meta.env.VITE_PUBLIC_CLOUDINARY_CLOUD_NAME,
156+
cloud_name: cloudName,
154157
controls,
155158
fontFace: fontFace || '',
156159
loop,

0 commit comments

Comments
 (0)