glitch-javascript-sdk 2.9.9 → 3.0.0
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/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Media.d.ts +40 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +40 -0
- package/package.json +1 -1
- package/src/api/Media.ts +54 -0
- package/src/routes/MediaRoute.ts +1 -0
package/dist/esm/api/Media.d.ts
CHANGED
|
@@ -97,6 +97,37 @@ export interface S3ConfirmRequest {
|
|
|
97
97
|
title?: string;
|
|
98
98
|
filename?: string;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Interfaces for the Video Editor Manifest
|
|
102
|
+
*/
|
|
103
|
+
export interface VideoEdit {
|
|
104
|
+
type: 'trim' | 'crop' | 'text' | 'speed' | 'overlay' | 'thumbnail';
|
|
105
|
+
params: TrimParams | CropParams | TextParams | SpeedParams | any;
|
|
106
|
+
}
|
|
107
|
+
export interface TrimParams {
|
|
108
|
+
start: number;
|
|
109
|
+
duration: number;
|
|
110
|
+
}
|
|
111
|
+
export interface CropParams {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
}
|
|
117
|
+
export interface TextParams {
|
|
118
|
+
text: string;
|
|
119
|
+
x: string | number;
|
|
120
|
+
y: string | number;
|
|
121
|
+
fontSize: number;
|
|
122
|
+
fontColor: string;
|
|
123
|
+
}
|
|
124
|
+
export interface SpeedParams {
|
|
125
|
+
multiplier: number;
|
|
126
|
+
}
|
|
127
|
+
export interface VideoProcessRequest {
|
|
128
|
+
edits: VideoEdit[];
|
|
129
|
+
output_format?: 'mp4' | 'webm';
|
|
130
|
+
}
|
|
100
131
|
declare class Media {
|
|
101
132
|
/**
|
|
102
133
|
* Upload media content using a File object.
|
|
@@ -249,5 +280,14 @@ declare class Media {
|
|
|
249
280
|
* @returns AxiosPromise containing the created Media resource.
|
|
250
281
|
*/
|
|
251
282
|
static confirmS3Upload<T>(data: S3ConfirmRequest): AxiosPromise<Response<T>>;
|
|
283
|
+
/**
|
|
284
|
+
* Submit a video for processing (Trim, Crop, Text, etc.)
|
|
285
|
+
* This triggers a background job on the server.
|
|
286
|
+
*
|
|
287
|
+
* @param media_id The UUID of the source video.
|
|
288
|
+
* @param data The edit manifest containing the array of transformations.
|
|
289
|
+
* @returns Promise with the pending_media_id.
|
|
290
|
+
*/
|
|
291
|
+
static process<T>(media_id: string, data: VideoProcessRequest): AxiosPromise<Response<T>>;
|
|
252
292
|
}
|
|
253
293
|
export default Media;
|
package/dist/esm/index.js
CHANGED
|
@@ -14913,6 +14913,7 @@ var MediaRoute = /** @class */ (function () {
|
|
|
14913
14913
|
uploadTikTokMusic: { url: '/media/tiktok/music', method: HTTP_METHODS.POST },
|
|
14914
14914
|
getPresignedUrl: { url: '/media/presigned-url', method: HTTP_METHODS.POST },
|
|
14915
14915
|
confirmS3Upload: { url: '/media/s3-confirm', method: HTTP_METHODS.POST },
|
|
14916
|
+
processVideo: { url: '/media/{media_id}/process', method: HTTP_METHODS.POST },
|
|
14916
14917
|
};
|
|
14917
14918
|
return MediaRoute;
|
|
14918
14919
|
}());
|
|
@@ -15164,6 +15165,17 @@ var Media = /** @class */ (function () {
|
|
|
15164
15165
|
Media.confirmS3Upload = function (data) {
|
|
15165
15166
|
return Requests.processRoute(MediaRoute.routes.confirmS3Upload, data);
|
|
15166
15167
|
};
|
|
15168
|
+
/**
|
|
15169
|
+
* Submit a video for processing (Trim, Crop, Text, etc.)
|
|
15170
|
+
* This triggers a background job on the server.
|
|
15171
|
+
*
|
|
15172
|
+
* @param media_id The UUID of the source video.
|
|
15173
|
+
* @param data The edit manifest containing the array of transformations.
|
|
15174
|
+
* @returns Promise with the pending_media_id.
|
|
15175
|
+
*/
|
|
15176
|
+
Media.process = function (media_id, data) {
|
|
15177
|
+
return Requests.processRoute(MediaRoute.routes.processVideo, data, { media_id: media_id });
|
|
15178
|
+
};
|
|
15167
15179
|
return Media;
|
|
15168
15180
|
}());
|
|
15169
15181
|
|