@stack0/sdk 0.5.12 → 0.5.14

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.
@@ -178,12 +178,55 @@ interface VideoVariant {
178
178
  codec?: VideoCodec;
179
179
  bitrate?: number;
180
180
  }
181
+ /**
182
+ * Watermark burned into a video during transcode.
183
+ *
184
+ * The image-watermark fields mirror the image-upload watermark config
185
+ * ({@link ImageWatermarkConfig}), so the same settings you use to watermark photos work
186
+ * for video — the original asset stays clean and every transcoded rendition is watermarked.
187
+ * Set `type: "text"` to burn a text string instead of a logo.
188
+ */
181
189
  interface WatermarkOptions {
182
- type: "image" | "text";
183
- imageAssetId?: string;
190
+ /** "image" (default) composites a logo; "text" burns a text string. */
191
+ type?: "image" | "text";
192
+ /** Logo source: another CDN asset (image watermark). Provide `assetId` or `url`. */
193
+ assetId?: string;
194
+ /** Logo source: a direct URL (image watermark, alternative to `assetId`). */
195
+ url?: string;
196
+ /** Text to render (required when `type` is "text"). */
184
197
  text?: string;
185
- position: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center";
198
+ /** Font family for text watermarks. */
199
+ fontFamily?: string;
200
+ /** Font size in pixels for text watermarks. */
201
+ fontSize?: number;
202
+ /** Text color as `#RRGGBB` (text watermarks). */
203
+ fontColor?: string;
204
+ /** Placement on the frame (default: "bottom-right"). */
205
+ position?: ImageWatermarkPosition;
206
+ /** Horizontal inset from the anchored edge in pixels (default: 20). */
207
+ offsetX?: number;
208
+ /** Vertical inset from the anchored edge in pixels (default: 20). */
209
+ offsetY?: number;
210
+ /** "relative" sizes by a percentage of the video width; "absolute" uses width/height (default: "relative"). */
211
+ sizingMode?: ImageWatermarkSizingMode;
212
+ /** Absolute width in pixels (used when `sizingMode` is "absolute"). */
213
+ width?: number;
214
+ /** Absolute height in pixels (used when `sizingMode` is "absolute"). */
215
+ height?: number;
216
+ /** Relative size as a percentage of the video width (used when `sizingMode` is "relative"; default: 15). */
217
+ scale?: number;
218
+ /** Opacity 0-100 (default: 80). */
186
219
  opacity?: number;
220
+ /** Tile the watermark across the whole frame, e.g. for copyright protection (default: false). */
221
+ tile?: boolean;
222
+ /** Horizontal spacing between tiles in pixels (default: 100). */
223
+ tileSpacingX?: number;
224
+ /** Vertical spacing between tiles in pixels (default: 100). */
225
+ tileSpacingY?: number;
226
+ /** Rotation in degrees, -360 to 360 (default: 0). Image watermarks only. */
227
+ rotation?: number;
228
+ /** Corner radius in pixels clipping the logo, 0-500 (default: 0). Image watermarks only. */
229
+ borderRadius?: number;
187
230
  }
188
231
  /** Position options for image watermarks */
189
232
  type ImageWatermarkPosition = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
@@ -1186,6 +1229,22 @@ declare class CDN {
1186
1229
  * });
1187
1230
  * console.log(`Job started: ${job.id}`);
1188
1231
  * ```
1232
+ *
1233
+ * @example Burn in a logo watermark (same config shape as image watermarks)
1234
+ * ```typescript
1235
+ * const job = await cdn.transcode({
1236
+ * projectSlug: 'my-project',
1237
+ * assetId: 'video-asset-id',
1238
+ * outputFormat: 'mp4',
1239
+ * variants: [{ quality: '1080p', codec: 'h264' }],
1240
+ * watermark: {
1241
+ * assetId: 'logo-asset-id',
1242
+ * position: 'bottom-right',
1243
+ * scale: 15, // 15% of the video width
1244
+ * opacity: 80,
1245
+ * },
1246
+ * });
1247
+ * ```
1189
1248
  */
1190
1249
  transcode(request: TranscodeVideoRequest): Promise<TranscodeJob>;
1191
1250
  /**
@@ -178,12 +178,55 @@ interface VideoVariant {
178
178
  codec?: VideoCodec;
179
179
  bitrate?: number;
180
180
  }
181
+ /**
182
+ * Watermark burned into a video during transcode.
183
+ *
184
+ * The image-watermark fields mirror the image-upload watermark config
185
+ * ({@link ImageWatermarkConfig}), so the same settings you use to watermark photos work
186
+ * for video — the original asset stays clean and every transcoded rendition is watermarked.
187
+ * Set `type: "text"` to burn a text string instead of a logo.
188
+ */
181
189
  interface WatermarkOptions {
182
- type: "image" | "text";
183
- imageAssetId?: string;
190
+ /** "image" (default) composites a logo; "text" burns a text string. */
191
+ type?: "image" | "text";
192
+ /** Logo source: another CDN asset (image watermark). Provide `assetId` or `url`. */
193
+ assetId?: string;
194
+ /** Logo source: a direct URL (image watermark, alternative to `assetId`). */
195
+ url?: string;
196
+ /** Text to render (required when `type` is "text"). */
184
197
  text?: string;
185
- position: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center";
198
+ /** Font family for text watermarks. */
199
+ fontFamily?: string;
200
+ /** Font size in pixels for text watermarks. */
201
+ fontSize?: number;
202
+ /** Text color as `#RRGGBB` (text watermarks). */
203
+ fontColor?: string;
204
+ /** Placement on the frame (default: "bottom-right"). */
205
+ position?: ImageWatermarkPosition;
206
+ /** Horizontal inset from the anchored edge in pixels (default: 20). */
207
+ offsetX?: number;
208
+ /** Vertical inset from the anchored edge in pixels (default: 20). */
209
+ offsetY?: number;
210
+ /** "relative" sizes by a percentage of the video width; "absolute" uses width/height (default: "relative"). */
211
+ sizingMode?: ImageWatermarkSizingMode;
212
+ /** Absolute width in pixels (used when `sizingMode` is "absolute"). */
213
+ width?: number;
214
+ /** Absolute height in pixels (used when `sizingMode` is "absolute"). */
215
+ height?: number;
216
+ /** Relative size as a percentage of the video width (used when `sizingMode` is "relative"; default: 15). */
217
+ scale?: number;
218
+ /** Opacity 0-100 (default: 80). */
186
219
  opacity?: number;
220
+ /** Tile the watermark across the whole frame, e.g. for copyright protection (default: false). */
221
+ tile?: boolean;
222
+ /** Horizontal spacing between tiles in pixels (default: 100). */
223
+ tileSpacingX?: number;
224
+ /** Vertical spacing between tiles in pixels (default: 100). */
225
+ tileSpacingY?: number;
226
+ /** Rotation in degrees, -360 to 360 (default: 0). Image watermarks only. */
227
+ rotation?: number;
228
+ /** Corner radius in pixels clipping the logo, 0-500 (default: 0). Image watermarks only. */
229
+ borderRadius?: number;
187
230
  }
188
231
  /** Position options for image watermarks */
189
232
  type ImageWatermarkPosition = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
@@ -1186,6 +1229,22 @@ declare class CDN {
1186
1229
  * });
1187
1230
  * console.log(`Job started: ${job.id}`);
1188
1231
  * ```
1232
+ *
1233
+ * @example Burn in a logo watermark (same config shape as image watermarks)
1234
+ * ```typescript
1235
+ * const job = await cdn.transcode({
1236
+ * projectSlug: 'my-project',
1237
+ * assetId: 'video-asset-id',
1238
+ * outputFormat: 'mp4',
1239
+ * variants: [{ quality: '1080p', codec: 'h264' }],
1240
+ * watermark: {
1241
+ * assetId: 'logo-asset-id',
1242
+ * position: 'bottom-right',
1243
+ * scale: 15, // 15% of the video width
1244
+ * opacity: 80,
1245
+ * },
1246
+ * });
1247
+ * ```
1189
1248
  */
1190
1249
  transcode(request: TranscodeVideoRequest): Promise<TranscodeJob>;
1191
1250
  /**
package/dist/cdn/index.js CHANGED
@@ -456,6 +456,22 @@ var CDN = class {
456
456
  * });
457
457
  * console.log(`Job started: ${job.id}`);
458
458
  * ```
459
+ *
460
+ * @example Burn in a logo watermark (same config shape as image watermarks)
461
+ * ```typescript
462
+ * const job = await cdn.transcode({
463
+ * projectSlug: 'my-project',
464
+ * assetId: 'video-asset-id',
465
+ * outputFormat: 'mp4',
466
+ * variants: [{ quality: '1080p', codec: 'h264' }],
467
+ * watermark: {
468
+ * assetId: 'logo-asset-id',
469
+ * position: 'bottom-right',
470
+ * scale: 15, // 15% of the video width
471
+ * opacity: 80,
472
+ * },
473
+ * });
474
+ * ```
459
475
  */
460
476
  async transcode(request) {
461
477
  const response = await this.http.post("/cdn/video/transcode", request);