@twick/studio 0.15.25 → 0.15.26
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/components/properties/generate-captions.d.ts +1 -1
- package/dist/hooks/use-generate-captions.d.ts +1 -1
- package/dist/hooks/use-studio-operation.d.ts +0 -2
- package/dist/index.js +56 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -17
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +15 -15
package/dist/index.mjs
CHANGED
|
@@ -3029,10 +3029,10 @@ const TEXT_STYLE_PRESETS = [
|
|
|
3029
3029
|
applyBackground: false
|
|
3030
3030
|
},
|
|
3031
3031
|
{
|
|
3032
|
-
id: "
|
|
3033
|
-
label: "
|
|
3032
|
+
id: "bold-caption",
|
|
3033
|
+
label: "Bold Caption",
|
|
3034
3034
|
description: "Bold white with strong outline",
|
|
3035
|
-
fontFamily: AVAILABLE_TEXT_FONTS.
|
|
3035
|
+
fontFamily: AVAILABLE_TEXT_FONTS.ROBOTO,
|
|
3036
3036
|
fontSize: 34,
|
|
3037
3037
|
fontWeight: 700,
|
|
3038
3038
|
textColor: "#FFFFFF",
|
|
@@ -3132,7 +3132,7 @@ const TEXT_STYLE_PRESETS = [
|
|
|
3132
3132
|
id: "cta-pill",
|
|
3133
3133
|
label: "CTA Pill",
|
|
3134
3134
|
description: "Call-to-action pill",
|
|
3135
|
-
fontFamily: AVAILABLE_TEXT_FONTS.
|
|
3135
|
+
fontFamily: AVAILABLE_TEXT_FONTS.LUCKIEST_GUY,
|
|
3136
3136
|
fontSize: 28,
|
|
3137
3137
|
fontWeight: 700,
|
|
3138
3138
|
textColor: "#FFFFFF",
|
|
@@ -6944,6 +6944,8 @@ function GenerateCaptionsPanel({
|
|
|
6944
6944
|
const [isGenerating, setIsGenerating] = useState(false);
|
|
6945
6945
|
const [pollingStatus, setPollingStatus] = useState("idle");
|
|
6946
6946
|
const [errorMessage, setErrorMessage] = useState(null);
|
|
6947
|
+
const [selectedLanguage, setSelectedLanguage] = useState("auto");
|
|
6948
|
+
const [wordsPerPhrase, setWordsPerPhrase] = useState(4);
|
|
6947
6949
|
const pollingIntervalRef = useRef(null);
|
|
6948
6950
|
const currentReqIdRef = useRef(null);
|
|
6949
6951
|
useEffect(() => {
|
|
@@ -7004,7 +7006,12 @@ function GenerateCaptionsPanel({
|
|
|
7004
7006
|
setPollingStatus("polling");
|
|
7005
7007
|
const videoElement = selectedElement;
|
|
7006
7008
|
try {
|
|
7007
|
-
const
|
|
7009
|
+
const language = selectedLanguage === "auto" ? void 0 : selectedLanguage;
|
|
7010
|
+
const reqId = await onGenerateCaptions(
|
|
7011
|
+
videoElement,
|
|
7012
|
+
language,
|
|
7013
|
+
wordsPerPhrase
|
|
7014
|
+
);
|
|
7008
7015
|
if (!reqId) {
|
|
7009
7016
|
setPollingStatus("error");
|
|
7010
7017
|
setIsGenerating(false);
|
|
@@ -7063,6 +7070,46 @@ function GenerateCaptionsPanel({
|
|
|
7063
7070
|
/* @__PURE__ */ jsx(Volume2, { className: "empty-state-icon" }),
|
|
7064
7071
|
/* @__PURE__ */ jsx("p", { className: "empty-state-text", children: "Audio detected! You can now generate captions" })
|
|
7065
7072
|
] }) }) }),
|
|
7073
|
+
!isLoading && containsAudio === true && /* @__PURE__ */ jsxs("div", { className: "panel-section", children: [
|
|
7074
|
+
/* @__PURE__ */ jsx("label", { className: "label-dark", htmlFor: "caption-language", children: "Audio Language" }),
|
|
7075
|
+
/* @__PURE__ */ jsxs(
|
|
7076
|
+
"select",
|
|
7077
|
+
{
|
|
7078
|
+
id: "caption-language",
|
|
7079
|
+
className: "select-dark",
|
|
7080
|
+
value: selectedLanguage,
|
|
7081
|
+
onChange: (e) => setSelectedLanguage(e.target.value),
|
|
7082
|
+
children: [
|
|
7083
|
+
/* @__PURE__ */ jsx("option", { value: "auto", children: "Auto (detect)" }),
|
|
7084
|
+
/* @__PURE__ */ jsx("option", { value: "english", children: "English" }),
|
|
7085
|
+
/* @__PURE__ */ jsx("option", { value: "italian", children: "Italian" }),
|
|
7086
|
+
/* @__PURE__ */ jsx("option", { value: "spanish", children: "Spanish" }),
|
|
7087
|
+
/* @__PURE__ */ jsx("option", { value: "portuguese", children: "Portuguese" }),
|
|
7088
|
+
/* @__PURE__ */ jsx("option", { value: "french", children: "French" }),
|
|
7089
|
+
/* @__PURE__ */ jsx("option", { value: "german", children: "German" }),
|
|
7090
|
+
/* @__PURE__ */ jsx("option", { value: "turkish", children: "Turkish" }),
|
|
7091
|
+
/* @__PURE__ */ jsx("option", { value: "indonesian", children: "Indonesian" }),
|
|
7092
|
+
/* @__PURE__ */ jsx("option", { value: "hindi", children: "Hindi" })
|
|
7093
|
+
]
|
|
7094
|
+
}
|
|
7095
|
+
)
|
|
7096
|
+
] }),
|
|
7097
|
+
!isLoading && containsAudio === true && /* @__PURE__ */ jsxs("div", { className: "panel-section", children: [
|
|
7098
|
+
/* @__PURE__ */ jsx("label", { className: "label-dark", htmlFor: "caption-words-per-phrase", children: "Words per phrase" }),
|
|
7099
|
+
/* @__PURE__ */ jsx(
|
|
7100
|
+
"select",
|
|
7101
|
+
{
|
|
7102
|
+
id: "caption-words-per-phrase",
|
|
7103
|
+
className: "select-dark",
|
|
7104
|
+
value: String(wordsPerPhrase),
|
|
7105
|
+
onChange: (e) => setWordsPerPhrase(Number(e.target.value) || 4),
|
|
7106
|
+
children: Array.from({ length: 10 }).map((_, index) => {
|
|
7107
|
+
const value = index + 1;
|
|
7108
|
+
return /* @__PURE__ */ jsx("option", { value, children: value }, value);
|
|
7109
|
+
})
|
|
7110
|
+
}
|
|
7111
|
+
)
|
|
7112
|
+
] }),
|
|
7066
7113
|
!isLoading && isGenerating && pollingStatus === "polling" && /* @__PURE__ */ jsx("div", { className: "panel-section", children: /* @__PURE__ */ jsx("div", { className: "empty-state", children: /* @__PURE__ */ jsxs("div", { className: "empty-state-content", children: [
|
|
7067
7114
|
/* @__PURE__ */ jsx(LoaderCircle, { className: "empty-state-icon animate-spin" }),
|
|
7068
7115
|
/* @__PURE__ */ jsx("p", { className: "empty-state-text", children: "Generating captions... Please wait" })
|
|
@@ -7598,15 +7645,6 @@ const useStudioOperation = (studioConfig) => {
|
|
|
7598
7645
|
const fileName = `${(projectName || "chapters").replace(/\.json$/i, "")}.${format === "youtube" ? "txt" : "json"}`;
|
|
7599
7646
|
await saveAsFile(content, "text/plain", fileName);
|
|
7600
7647
|
};
|
|
7601
|
-
const onGenerateCaptions = async (videoElement) => {
|
|
7602
|
-
if (studioConfig == null ? void 0 : studioConfig.captionGenerationService) {
|
|
7603
|
-
const service = studioConfig.captionGenerationService;
|
|
7604
|
-
const reqId = await service.generateCaptions(videoElement, present);
|
|
7605
|
-
return reqId;
|
|
7606
|
-
}
|
|
7607
|
-
alert("Generate captions not supported in demo mode");
|
|
7608
|
-
return null;
|
|
7609
|
-
};
|
|
7610
7648
|
const addCaptionsToTimeline = (captions) => {
|
|
7611
7649
|
var _a;
|
|
7612
7650
|
const updatedProjectJSON = (_a = studioConfig == null ? void 0 : studioConfig.captionGenerationService) == null ? void 0 : _a.updateProjectWithCaptions(captions);
|
|
@@ -7631,7 +7669,6 @@ const useStudioOperation = (studioConfig) => {
|
|
|
7631
7669
|
onNewProject,
|
|
7632
7670
|
onExportCaptions,
|
|
7633
7671
|
onExportChapters,
|
|
7634
|
-
onGenerateCaptions,
|
|
7635
7672
|
addCaptionsToTimeline,
|
|
7636
7673
|
getCaptionstatus
|
|
7637
7674
|
};
|
|
@@ -7740,12 +7777,14 @@ function TwickStudio({ studioConfig }) {
|
|
|
7740
7777
|
const useGenerateCaptions = (studioConfig) => {
|
|
7741
7778
|
var _a;
|
|
7742
7779
|
const { editor, present } = useTimelineContext();
|
|
7743
|
-
const onGenerateCaptions = async (videoElement) => {
|
|
7780
|
+
const onGenerateCaptions = async (videoElement, language, wordsPerPhrase) => {
|
|
7744
7781
|
if (studioConfig == null ? void 0 : studioConfig.captionGenerationService) {
|
|
7745
7782
|
const service = studioConfig.captionGenerationService;
|
|
7746
7783
|
const reqId = await service.generateCaptions(
|
|
7747
7784
|
videoElement,
|
|
7748
|
-
present
|
|
7785
|
+
present,
|
|
7786
|
+
language,
|
|
7787
|
+
wordsPerPhrase
|
|
7749
7788
|
);
|
|
7750
7789
|
return reqId;
|
|
7751
7790
|
}
|