diff --git a/astro-cloudinary/src/components/CldUploadWidget.astro b/astro-cloudinary/src/components/CldUploadWidget.astro
index 2aab503..113385a 100644
--- a/astro-cloudinary/src/components/CldUploadWidget.astro
+++ b/astro-cloudinary/src/components/CldUploadWidget.astro
@@ -44,93 +44,116 @@ if ( typeof className === 'string' ) {
-
-
\ No newline at end of file
diff --git a/astro-cloudinary/src/components/CldVideoPlayer.astro b/astro-cloudinary/src/components/CldVideoPlayer.astro
index 7e9cdcc..4ad8ab0 100644
--- a/astro-cloudinary/src/components/CldVideoPlayer.astro
+++ b/astro-cloudinary/src/components/CldVideoPlayer.astro
@@ -7,7 +7,7 @@ import type { CloudinaryVideoPlayerOptions, CloudinaryVideoPlayerOptionsLogo } f
import type { GetCldImageUrlOptions } from "../helpers/getCldImageUrl";
import type { GetCldVideoUrlOptions } from "../helpers/getCldVideoUrl";
-const PLAYER_VERSION = '2.0.5';
+const PLAYER_VERSION = '2.1.0';
export interface CldVideoPlayerProps extends Omit {
class?: string;
@@ -73,82 +73,101 @@ if ( className ) {
/>
-
-
\ No newline at end of file
diff --git a/astro-cloudinary/src/lib/util.ts b/astro-cloudinary/src/lib/util.ts
index c9e7461..aeaf528 100644
--- a/astro-cloudinary/src/lib/util.ts
+++ b/astro-cloudinary/src/lib/util.ts
@@ -8,4 +8,45 @@ export function triggerOnIdle(callback: any) {
return requestIdleCallback(callback);
}
return setTimeout(() => callback(), 1);
+}
+
+/**
+ * loadScript
+ */
+
+export function loadScript(src: string) {
+ return new Promise((resolve, reject) => {
+ if ( typeof document === 'undefined' ) {
+ reject('Can not be loaded on')
+ }
+
+ const script = document.createElement('script');
+
+ script.src = src;
+ script.async = true;
+
+ document.body.appendChild(script);
+
+ function handleOnLoad() {
+ cleanup();
+ resolve({
+ script
+ });
+ }
+
+ function handleOnError() {
+ cleanup();
+ reject({
+ script
+ })
+ }
+
+ script.addEventListener('load', handleOnLoad);
+ script.addEventListener('error', handleOnError);
+
+ function cleanup() {
+ script.removeEventListener('load', handleOnLoad);
+ script.removeEventListener('error', handleOnError);
+ }
+ })
}
\ No newline at end of file