call-control-sdk 6.4.5-beta.6 → 6.4.5-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +42 -3
- package/dist/index.mjs +42 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2738,6 +2738,41 @@ function CallHistoryDialog({ open, setOpen }) {
|
|
|
2738
2738
|
// call-control-sdk/lib/ringtones/incoming.mp3
|
|
2739
2739
|
var incoming_default = "./incoming-4WP3FJI4.mp3";
|
|
2740
2740
|
|
|
2741
|
+
// call-control-sdk/lib/utils/audioLoader.ts
|
|
2742
|
+
var audioBlobUrl = null;
|
|
2743
|
+
var audioBuffer = null;
|
|
2744
|
+
async function loadAudioAsBlob() {
|
|
2745
|
+
if (audioBlobUrl) {
|
|
2746
|
+
return audioBlobUrl;
|
|
2747
|
+
}
|
|
2748
|
+
try {
|
|
2749
|
+
const response = await fetch(incoming_default);
|
|
2750
|
+
if (!response.ok) {
|
|
2751
|
+
throw new Error(`Failed to load audio: ${response.statusText}`);
|
|
2752
|
+
}
|
|
2753
|
+
const blob = await response.blob();
|
|
2754
|
+
audioBlobUrl = URL.createObjectURL(blob);
|
|
2755
|
+
return audioBlobUrl;
|
|
2756
|
+
} catch (error) {
|
|
2757
|
+
console.error("Error loading audio as blob:", error);
|
|
2758
|
+
return incoming_default;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
async function createAudioElement() {
|
|
2762
|
+
const blobUrl = await loadAudioAsBlob();
|
|
2763
|
+
const audio = new Audio(blobUrl);
|
|
2764
|
+
audio.loop = true;
|
|
2765
|
+
audio.volume = 0.7;
|
|
2766
|
+
return audio;
|
|
2767
|
+
}
|
|
2768
|
+
function cleanupAudioResources() {
|
|
2769
|
+
if (audioBlobUrl) {
|
|
2770
|
+
URL.revokeObjectURL(audioBlobUrl);
|
|
2771
|
+
audioBlobUrl = null;
|
|
2772
|
+
}
|
|
2773
|
+
audioBuffer = null;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2741
2776
|
// call-control-sdk/lib/components/callControls.tsx
|
|
2742
2777
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2743
2778
|
var getCombineConfrenceData = (conferenceData, apiData, data) => {
|
|
@@ -2946,15 +2981,19 @@ function CallControls({ onDataChange }) {
|
|
|
2946
2981
|
};
|
|
2947
2982
|
}, [state.callData.status]);
|
|
2948
2983
|
(0, import_react11.useEffect)(() => {
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2984
|
+
createAudioElement().then((audio) => {
|
|
2985
|
+
audioRef.current = audio;
|
|
2986
|
+
}).catch((error) => {
|
|
2987
|
+
console.error("Failed to load audio element:", error);
|
|
2988
|
+
});
|
|
2952
2989
|
return () => {
|
|
2953
2990
|
if (audioRef.current) {
|
|
2954
2991
|
audioRef.current.pause();
|
|
2955
2992
|
audioRef.current.currentTime = 0;
|
|
2993
|
+
audioRef.current.src = "";
|
|
2956
2994
|
audioRef.current = null;
|
|
2957
2995
|
}
|
|
2996
|
+
cleanupAudioResources();
|
|
2958
2997
|
};
|
|
2959
2998
|
}, []);
|
|
2960
2999
|
(0, import_react11.useEffect)(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -2757,6 +2757,41 @@ function CallHistoryDialog({ open, setOpen }) {
|
|
|
2757
2757
|
// call-control-sdk/lib/ringtones/incoming.mp3
|
|
2758
2758
|
var incoming_default = "./incoming-4WP3FJI4.mp3";
|
|
2759
2759
|
|
|
2760
|
+
// call-control-sdk/lib/utils/audioLoader.ts
|
|
2761
|
+
var audioBlobUrl = null;
|
|
2762
|
+
var audioBuffer = null;
|
|
2763
|
+
async function loadAudioAsBlob() {
|
|
2764
|
+
if (audioBlobUrl) {
|
|
2765
|
+
return audioBlobUrl;
|
|
2766
|
+
}
|
|
2767
|
+
try {
|
|
2768
|
+
const response = await fetch(incoming_default);
|
|
2769
|
+
if (!response.ok) {
|
|
2770
|
+
throw new Error(`Failed to load audio: ${response.statusText}`);
|
|
2771
|
+
}
|
|
2772
|
+
const blob = await response.blob();
|
|
2773
|
+
audioBlobUrl = URL.createObjectURL(blob);
|
|
2774
|
+
return audioBlobUrl;
|
|
2775
|
+
} catch (error) {
|
|
2776
|
+
console.error("Error loading audio as blob:", error);
|
|
2777
|
+
return incoming_default;
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
async function createAudioElement() {
|
|
2781
|
+
const blobUrl = await loadAudioAsBlob();
|
|
2782
|
+
const audio = new Audio(blobUrl);
|
|
2783
|
+
audio.loop = true;
|
|
2784
|
+
audio.volume = 0.7;
|
|
2785
|
+
return audio;
|
|
2786
|
+
}
|
|
2787
|
+
function cleanupAudioResources() {
|
|
2788
|
+
if (audioBlobUrl) {
|
|
2789
|
+
URL.revokeObjectURL(audioBlobUrl);
|
|
2790
|
+
audioBlobUrl = null;
|
|
2791
|
+
}
|
|
2792
|
+
audioBuffer = null;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2760
2795
|
// call-control-sdk/lib/components/callControls.tsx
|
|
2761
2796
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2762
2797
|
var getCombineConfrenceData = (conferenceData, apiData, data) => {
|
|
@@ -2965,15 +3000,19 @@ function CallControls({ onDataChange }) {
|
|
|
2965
3000
|
};
|
|
2966
3001
|
}, [state.callData.status]);
|
|
2967
3002
|
useEffect5(() => {
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
3003
|
+
createAudioElement().then((audio) => {
|
|
3004
|
+
audioRef.current = audio;
|
|
3005
|
+
}).catch((error) => {
|
|
3006
|
+
console.error("Failed to load audio element:", error);
|
|
3007
|
+
});
|
|
2971
3008
|
return () => {
|
|
2972
3009
|
if (audioRef.current) {
|
|
2973
3010
|
audioRef.current.pause();
|
|
2974
3011
|
audioRef.current.currentTime = 0;
|
|
3012
|
+
audioRef.current.src = "";
|
|
2975
3013
|
audioRef.current = null;
|
|
2976
3014
|
}
|
|
3015
|
+
cleanupAudioResources();
|
|
2977
3016
|
};
|
|
2978
3017
|
}, []);
|
|
2979
3018
|
useEffect5(() => {
|