You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -43,18 +54,18 @@ CameraKit Web as the name suggests, is our camera platform for websites. In addi
43
54
44
55
## Setup
45
56
46
-
Install the `camerakit-web` package.
57
+
Install the `camerakit` package.
47
58
48
59
```
49
-
$ npm install camerakit-web
60
+
$ npm install camerakit
50
61
```
51
62
52
63
## Usage
53
64
54
-
Import and use `camerakit-web` in your project.
65
+
Import and use `camerakit` in your project.
55
66
56
67
```js
57
-
importcamerakitfrom"camerakit-web";
68
+
importcamerakitfrom"camerakit";
58
69
```
59
70
60
71
Or, alternatively, you can import via a script tag:
@@ -64,38 +75,38 @@ Or, alternatively, you can import via a script tag:
64
75
<!-- You can now access `camerakit` from the global scope -->
65
76
```
66
77
67
-
To properly support `webm` video recording and playback on Safari, you'll need to host the WebAssembly(wasm) and worker files packaged in `dist/browser/` on your webserver. The video recorder and player require these in order to function properly on Safari.
78
+
For additional Safari requirements, see [Safari support details](#safari).
constrecordedVideo=awaitmyRecorder.stop(); // Use the video yourself
104
+
constrecordedVideo=awaitpreview.recorder.stop(); // Use the video yourself
94
105
95
-
myRecorder.downloadLatestRecording(); // Download the video direct from browser
106
+
preview.recorder.downloadLatestRecording(); // Download the video direct from browser
96
107
97
108
// Stop using camera
98
-
myStream.destroy();
109
+
preview.destroy();
99
110
100
111
// Play video via camerakit player
101
112
constplayer=newcamerakit.Player();
@@ -107,14 +118,14 @@ async function () {
107
118
}
108
119
```
109
120
110
-
## Safari support details
121
+
## Safari support details<aid="safari"></a>
111
122
112
-
**Safari audio recording and video seeking are not currently supported.**
123
+
Currently, the WebAssembly and JS worker files used for video recording and playback on Safari must be hosted seperately on a webserver. The compiled files can be found in `dist/browser/`, ensure they're accessible via a public URL (e.g `https://myurl.com/myWorkerFile.js`).
113
124
114
-
If you'd like to host the wasm/worker files in a subdirectory, you'll need to update the `base` param on `camerakit.Loader` and as well as to `fallbackConfig` when calling `createCaptureStream`:
125
+
If you'd like to host the wasm/worker files in a custom path, you'll need to update the `base` param on `camerakit.Loader` and as well as to `fallbackConfig` when calling `createCaptureStream`:
115
126
116
127
```js
117
-
importcamerakitfrom"camerakit-web";
128
+
importcamerakitfrom"camerakit";
118
129
119
130
asyncfunction () {
120
131
// Point fallback video player to correct directory
@@ -143,6 +154,8 @@ async function () {
143
154
|`camerakit.createCaptureStream`|`{audio?: MediaSource, video?: MediaSource, fallbackConfig?: Partial<FallbackConfig>}`|`Promise<CaptureStream>`| Creates new `CaptureStream` instance with provided media inputs |
144
155
|`camerakit.enableStorage`|`{method?: "localStorage" \| "sessionStorage" \| null}`|`void`| Enables photo storage as a default |
145
156
|`camerakit.disableStorage`| none |`void`| Disables photo storage as a default |
157
+
|`camerakit.enableDebug`| none |`void`| Enables debug mode for logging output |
|`stream.init`| none |`Promise<void>`| Initializes stream and requests permissions from browser |
161
-
|`stream.setResolution`|`{width?: number, height?: number, aspect?: number, source?: "original" \| "preview"}`|`Promise<void>`| Sets the video resolution of the specified source |
162
-
|`stream.setSource`|`{audio?: MediaSource, video?: MediaSource, source?: "original" \| "preview"}`|`Promise<void>`| Overrides original media inputs for specified source |
163
-
|`stream.getMediaStream`|`{source?: "original" \| "preview"}`|`Promise<MediaStream>`| Returns raw `MediaStream` for use in video display |
164
-
|`stream.destroy`| none |`void`| Closes all open streams and cancels capture |
|`stream.init`| none |`Promise<void>`| Initializes stream and requests permissions from browser |
174
+
|`stream.setResolution`|`{width?: number, height?: number, aspect?: number, source?: "original" \| "preview"}`|`Promise<void>`| Sets the video resolution of the specified source |
175
+
|`stream.setSource`|`{audio?: MediaSource, video?: MediaSource, source?: "original" \| "preview"}`|`Promise<void>`| Overrides original media inputs for specified source |
176
+
|`stream.getPreview`|`{source?: "original" \| "preview"}`|`HTMLVideoElement`| Returns an video element with the appropriate internal event handlers |
177
+
|`stream.getMediaStream`|`{source?: "original" \| "preview"}`|`Promise<MediaStream>`| Returns raw `MediaStream` for use in video display |
178
+
|`stream.destroy`| none |`void`| Closes all open streams and cancels capture |
165
179
166
180
#### Properties
167
181
@@ -176,26 +190,26 @@ Used for taking photos of the `CaptureStream`.
|`shutter.capture`| `{source?: "original" \| "preview", save?: "localStorage" | "sessionStorage" | null}` |`string`| Takes and returns picture from specified source |
182
-
|`shutter.captureAndDownload`|`{source?: "original" \| "preview", filename?: string}`|`boolean`| Calls `capture` and creates file download from result |
183
-
|`shutter.downloadLatestCapture`|`filename?: string`|`boolean`| Downloads the last picture taken |
|`shutter.capture`|`{source?: "original" \| "preview", save?: "localStorage" \| "sessionStorage" \| null}`|`string`| Takes and returns picture from specified source |
196
+
|`shutter.captureAndDownload`|`{source?: "original" \| "preview", filename?: string}`|`boolean`| Calls `capture` and creates file download from result |
197
+
|`shutter.downloadLatestCapture`|`filename?: string`|`boolean`| Downloads the last picture taken |
184
198
185
199
### `Recorder`
186
200
187
201
Used for recording video of the the `CaptureStream`.
|`recorder.start`|`{source?: "original" \| "preview"}`|`Promise<void>`| Starts the recording from the specified source|
194
-
|`recorder.stop`| none |`Promise<?[Blob, ?Blob]>`| Stops the recording and returns an array. First Blob is Video (and audio if available), the second is Audio on Safari.|
195
-
|`recorder.pause`| none |`Promise<void>`| Pauses the recording until resumed with `recorder.start()`|
196
-
|`recorder.getLatestRecording`| none |`?Blob`| Returns last recorded video file|
197
-
|`recorder.downloadLatestRecording`|`filename?: string`|`boolean`| Creates file download from last video recording|
198
-
|`recorder.setMimeType`|`mimeType: string`|`boolean`| Sets the video recording mime type for all sources|
0 commit comments