@twick/studio 0.15.25 → 0.15.27
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 +3 -2
- package/dist/helpers/generate-captions.service.d.ts +4 -4
- package/dist/hooks/use-generate-captions.d.ts +2 -2
- package/dist/hooks/use-studio-operation.d.ts +0 -2
- package/dist/index.js +57 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -17
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +2 -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 [phraseLength, setPhraseLength] = useState("medium");
|
|
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
|
+
phraseLength
|
|
7014
|
+
);
|
|
7008
7015
|
if (!reqId) {
|
|
7009
7016
|
setPollingStatus("error");
|
|
7010
7017
|
setIsGenerating(false);
|
|
@@ -7063,6 +7070,47 @@ 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-phrase-length", children: "Caption length" }),
|
|
7099
|
+
/* @__PURE__ */ jsxs(
|
|
7100
|
+
"select",
|
|
7101
|
+
{
|
|
7102
|
+
id: "caption-phrase-length",
|
|
7103
|
+
className: "select-dark",
|
|
7104
|
+
value: phraseLength,
|
|
7105
|
+
onChange: (e) => setPhraseLength(e.target.value),
|
|
7106
|
+
children: [
|
|
7107
|
+
/* @__PURE__ */ jsx("option", { value: "short", children: "Short" }),
|
|
7108
|
+
/* @__PURE__ */ jsx("option", { value: "medium", children: "Medium" }),
|
|
7109
|
+
/* @__PURE__ */ jsx("option", { value: "long", children: "Long" })
|
|
7110
|
+
]
|
|
7111
|
+
}
|
|
7112
|
+
)
|
|
7113
|
+
] }),
|
|
7066
7114
|
!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
7115
|
/* @__PURE__ */ jsx(LoaderCircle, { className: "empty-state-icon animate-spin" }),
|
|
7068
7116
|
/* @__PURE__ */ jsx("p", { className: "empty-state-text", children: "Generating captions... Please wait" })
|
|
@@ -7598,15 +7646,6 @@ const useStudioOperation = (studioConfig) => {
|
|
|
7598
7646
|
const fileName = `${(projectName || "chapters").replace(/\.json$/i, "")}.${format === "youtube" ? "txt" : "json"}`;
|
|
7599
7647
|
await saveAsFile(content, "text/plain", fileName);
|
|
7600
7648
|
};
|
|
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
7649
|
const addCaptionsToTimeline = (captions) => {
|
|
7611
7650
|
var _a;
|
|
7612
7651
|
const updatedProjectJSON = (_a = studioConfig == null ? void 0 : studioConfig.captionGenerationService) == null ? void 0 : _a.updateProjectWithCaptions(captions);
|
|
@@ -7631,7 +7670,6 @@ const useStudioOperation = (studioConfig) => {
|
|
|
7631
7670
|
onNewProject,
|
|
7632
7671
|
onExportCaptions,
|
|
7633
7672
|
onExportChapters,
|
|
7634
|
-
onGenerateCaptions,
|
|
7635
7673
|
addCaptionsToTimeline,
|
|
7636
7674
|
getCaptionstatus
|
|
7637
7675
|
};
|
|
@@ -7740,12 +7778,14 @@ function TwickStudio({ studioConfig }) {
|
|
|
7740
7778
|
const useGenerateCaptions = (studioConfig) => {
|
|
7741
7779
|
var _a;
|
|
7742
7780
|
const { editor, present } = useTimelineContext();
|
|
7743
|
-
const onGenerateCaptions = async (videoElement) => {
|
|
7781
|
+
const onGenerateCaptions = async (videoElement, language, phraseLength) => {
|
|
7744
7782
|
if (studioConfig == null ? void 0 : studioConfig.captionGenerationService) {
|
|
7745
7783
|
const service = studioConfig.captionGenerationService;
|
|
7746
7784
|
const reqId = await service.generateCaptions(
|
|
7747
7785
|
videoElement,
|
|
7748
|
-
present
|
|
7786
|
+
present,
|
|
7787
|
+
language,
|
|
7788
|
+
phraseLength
|
|
7749
7789
|
);
|
|
7750
7790
|
return reqId;
|
|
7751
7791
|
}
|