@snap/camera-kit 1.0.1 → 1.2.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/README.md +1 -1
- package/dist/CameraKit.d.ts +17 -6
- package/dist/CameraKit.d.ts.map +1 -1
- package/dist/CameraKit.js +26 -4
- package/dist/CameraKit.js.map +1 -1
- package/dist/RootServices.d.ts +6 -2
- package/dist/RootServices.d.ts.map +1 -1
- package/dist/RootServices.js.map +1 -1
- package/dist/bootstrapCameraKit.d.ts.map +1 -1
- package/dist/bootstrapCameraKit.js +6 -2
- package/dist/bootstrapCameraKit.js.map +1 -1
- package/dist/clients/remoteApiSpecsClient.d.ts +10 -0
- package/dist/clients/remoteApiSpecsClient.d.ts.map +1 -0
- package/dist/clients/remoteApiSpecsClient.js +6 -0
- package/dist/clients/remoteApiSpecsClient.js.map +1 -0
- package/dist/common/typeguards.d.ts +3 -0
- package/dist/common/typeguards.d.ts.map +1 -1
- package/dist/common/typeguards.js +12 -0
- package/dist/common/typeguards.js.map +1 -1
- package/dist/configuration.d.ts +115 -0
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +1 -0
- package/dist/configuration.js.map +1 -1
- package/dist/environment.js +1 -1
- package/dist/environment.js.map +1 -1
- package/dist/extensions/extensionRequestContext.d.ts +6 -0
- package/dist/extensions/extensionRequestContext.d.ts.map +1 -1
- package/dist/extensions/extensionRequestContext.js +3 -2
- package/dist/extensions/extensionRequestContext.js.map +1 -1
- package/dist/geo/geoDataProvider.d.ts +32 -0
- package/dist/geo/geoDataProvider.d.ts.map +1 -0
- package/dist/geo/geoDataProvider.js +25 -0
- package/dist/geo/geoDataProvider.js.map +1 -0
- package/dist/geo/registerGeoDataProvider.d.ts +11 -0
- package/dist/geo/registerGeoDataProvider.d.ts.map +1 -0
- package/dist/geo/registerGeoDataProvider.js +22 -0
- package/dist/geo/registerGeoDataProvider.js.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/lens-core-module/generated-types.d.ts +28 -0
- package/dist/lens-core-module/generated-types.d.ts.map +1 -1
- package/dist/lens-core-module/generated-types.js.map +1 -1
- package/dist/lens-core-module/lensCore.d.ts.map +1 -1
- package/dist/lens-core-module/lensCore.js +1 -0
- package/dist/lens-core-module/lensCore.js.map +1 -1
- package/dist/lensCoreWasmVersions.js +3 -3
- package/dist/lensCoreWasmVersions.js.map +1 -1
- package/dist/platform/platformInfo.d.ts.map +1 -1
- package/dist/platform/platformInfo.js +1 -1
- package/dist/platform/platformInfo.js.map +1 -1
- package/dist/remote-configuration/cofHandler.js.map +1 -1
- package/dist/remote-configuration/remoteConfiguration.d.ts +4 -0
- package/dist/remote-configuration/remoteConfiguration.d.ts.map +1 -1
- package/dist/remote-configuration/remoteConfiguration.js +10 -0
- package/dist/remote-configuration/remoteConfiguration.js.map +1 -1
- package/dist/session/CameraKitSession.d.ts +9 -9
- package/dist/session/CameraKitSession.d.ts.map +1 -1
- package/dist/session/CameraKitSession.js +4 -2
- package/dist/session/CameraKitSession.js.map +1 -1
- package/dist/session/LensKeyboard.d.ts +75 -31
- package/dist/session/LensKeyboard.d.ts.map +1 -1
- package/dist/session/LensKeyboard.js +60 -38
- package/dist/session/LensKeyboard.js.map +1 -1
- package/dist/uri-handlers/UriHandlers.d.ts.map +1 -0
- package/dist/uri-handlers/UriHandlers.js.map +1 -0
- package/dist/uri-handlers/internal-handlers/httpUriHandler.d.ts +42 -0
- package/dist/uri-handlers/internal-handlers/httpUriHandler.d.ts.map +1 -0
- package/dist/uri-handlers/internal-handlers/httpUriHandler.js +149 -0
- package/dist/uri-handlers/internal-handlers/httpUriHandler.js.map +1 -0
- package/dist/uri-handlers/internal-handlers/httpValidators.d.ts +9 -0
- package/dist/uri-handlers/internal-handlers/httpValidators.d.ts.map +1 -0
- package/dist/uri-handlers/internal-handlers/httpValidators.js +115 -0
- package/dist/uri-handlers/internal-handlers/httpValidators.js.map +1 -0
- package/dist/{extensions/RemoteApiServices.d.ts → uri-handlers/internal-handlers/remoteApiUriHandler.d.ts} +8 -8
- package/dist/uri-handlers/internal-handlers/remoteApiUriHandler.d.ts.map +1 -0
- package/dist/uri-handlers/internal-handlers/remoteApiUriHandler.js +121 -0
- package/dist/uri-handlers/internal-handlers/remoteApiUriHandler.js.map +1 -0
- package/dist/{extensions → uri-handlers}/uriHandlersRegister.d.ts +6 -4
- package/dist/uri-handlers/uriHandlersRegister.d.ts.map +1 -0
- package/dist/{extensions → uri-handlers}/uriHandlersRegister.js +13 -3
- package/dist/uri-handlers/uriHandlersRegister.js.map +1 -0
- package/dist/uri-handlers/uriRequestProcessor.d.ts +37 -0
- package/dist/uri-handlers/uriRequestProcessor.d.ts.map +1 -0
- package/dist/uri-handlers/uriRequestProcessor.js +69 -0
- package/dist/uri-handlers/uriRequestProcessor.js.map +1 -0
- package/docs/html/assets/hierarchy.js +1 -0
- package/docs/html/assets/highlight.css +9 -2
- package/docs/html/assets/icons.js +18 -0
- package/docs/html/assets/icons.svg +1 -0
- package/docs/html/assets/main.js +5 -4
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +1422 -1226
- package/docs/html/classes/CameraKit.html +18 -16
- package/docs/html/classes/CameraKitSession.html +79 -51
- package/docs/html/classes/CameraKitSource.html +18 -18
- package/docs/html/classes/LensPerformanceMeasurement.html +11 -11
- package/docs/html/classes/LensPerformanceMetrics.html +8 -7
- package/docs/html/classes/LensRepository.html +25 -23
- package/docs/html/classes/Transform2D.html +9 -9
- package/docs/html/classes/TypedCustomEvent.html +5 -4
- package/docs/html/classes/TypedEventTarget.html +6 -6
- package/docs/html/enums/Lens_CameraFacing.html +5 -5
- package/docs/html/functions/bootstrapCameraKit.html +11 -10
- package/docs/html/functions/createExtension.html +7 -6
- package/docs/html/functions/createImageSource.html +5 -5
- package/docs/html/functions/createMediaStreamSource.html +5 -5
- package/docs/html/functions/createVideoSource.html +5 -5
- package/docs/html/functions/estimateLensPerformance.html +2 -2
- package/docs/html/functions/filePickerFactory.html +2 -2
- package/docs/html/functions/getExtensionRequestContext.html +3 -0
- package/docs/html/functions/lensSourcesFactory.html +5 -4
- package/docs/html/functions/remoteApiServicesFactory.html +1 -1
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +111 -88
- package/docs/html/interfaces/BitmojiUserInfo.html +3 -3
- package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +40 -21
- package/docs/html/interfaces/CameraKitDeviceOptions.html +7 -7
- package/docs/html/interfaces/CameraKitSourceInfo.html +7 -7
- package/docs/html/interfaces/CameraKitSourceSubscriber.html +4 -4
- package/docs/html/interfaces/ComputedFrameMetrics.html +6 -6
- package/docs/html/interfaces/CreateSessionOptions.html +7 -7
- package/docs/html/interfaces/EstimatedLensPerformance.html +5 -5
- package/docs/html/interfaces/Font.html +6 -0
- package/docs/html/interfaces/FriendUserInfo.html +4 -4
- package/docs/html/interfaces/FunctionSourceOptions.html +4 -4
- package/docs/html/interfaces/Keyboard.html +29 -0
- package/docs/html/interfaces/KeyboardActiveEvent.html +12 -0
- package/docs/html/interfaces/Lens.html +21 -21
- package/docs/html/interfaces/LensCreator.html +3 -3
- package/docs/html/interfaces/LensHttpRequest.html +16 -0
- package/docs/html/interfaces/LensLaunchData.html +6 -6
- package/docs/html/interfaces/LensSource.html +5 -5
- package/docs/html/interfaces/LensUserData.html +10 -10
- package/docs/html/interfaces/LoadAssetRequest.html +10 -10
- package/docs/html/interfaces/MediaStreamSourceOptions.html +11 -11
- package/docs/html/interfaces/Preview.html +4 -4
- package/docs/html/interfaces/RemoteApiRequest.html +10 -10
- package/docs/html/interfaces/RemoteApiResponse.html +8 -8
- package/docs/html/interfaces/RemoteApiService.html +9 -9
- package/docs/html/interfaces/Snapcode.html +6 -6
- package/docs/html/interfaces/UriCancelRequest.html +3 -3
- package/docs/html/interfaces/UriRequest.html +7 -7
- package/docs/html/interfaces/UriResponse.html +6 -6
- package/docs/html/interfaces/VideoSourceOptions.html +9 -9
- package/docs/html/modules.html +1 -99
- package/docs/html/types/ArgumentValidationError.html +2 -2
- package/docs/html/types/AssetLoader.html +4 -4
- package/docs/html/types/AssetResponse.html +1 -1
- package/docs/html/types/AssetTiming.html +2 -2
- package/docs/html/types/BenchmarkError.html +1 -1
- package/docs/html/types/BootstrapError.html +2 -2
- package/docs/html/types/CacheKeyNotFoundError.html +1 -1
- package/docs/html/types/CameraKitSessionEventListener.html +2 -2
- package/docs/html/types/CameraKitSessionEvents.html +4 -3
- package/docs/html/types/CameraKitSourceError.html +1 -1
- package/docs/html/types/ConfigurationError.html +2 -2
- package/docs/html/types/FetchHandler.html +1 -1
- package/docs/html/types/FilePicker.html +5 -5
- package/docs/html/types/FilePickerOptions.html +2 -2
- package/docs/html/types/FilePickerResult.html +2 -2
- package/docs/html/types/KeyboardEventListener.html +2 -0
- package/docs/html/types/KeyboardEvents.html +2 -2
- package/docs/html/types/LegalError.html +1 -1
- package/docs/html/types/LensAbortError.html +6 -5
- package/docs/html/types/LensAssetError.html +2 -2
- package/docs/html/types/LensContentValidationError.html +1 -1
- package/docs/html/types/LensError.html +1 -1
- package/docs/html/types/LensExecutionError.html +6 -5
- package/docs/html/types/LensHttpHandler.html +9 -0
- package/docs/html/types/LensImagePickerError.html +2 -2
- package/docs/html/types/LensLaunchParams.html +2 -2
- package/docs/html/types/LensMetricsEvents.html +2 -2
- package/docs/html/types/LensPerformanceCluster.html +1 -1
- package/docs/html/types/LensView.html +3 -3
- package/docs/html/types/LensWait.html +2 -2
- package/docs/html/types/Matrix.html +2 -2
- package/docs/html/types/PersistentStoreError.html +2 -2
- package/docs/html/types/PlatformNotSupportedError.html +3 -3
- package/docs/html/types/PublicContainer.html +2 -2
- package/docs/html/types/PublicServices.html +2 -2
- package/docs/html/types/RemoteApiCancelRequestHandler.html +2 -2
- package/docs/html/types/RemoteApiRequestHandler.html +2 -2
- package/docs/html/types/RemoteApiServices.html +1 -1
- package/docs/html/types/RemoteApiStatus.html +2 -2
- package/docs/html/types/RenderTarget.html +3 -3
- package/docs/html/types/Uri.html +1 -1
- package/docs/html/types/WebGLError.html +1 -1
- package/docs/html/types/Zodiac.html +1 -1
- package/docs/html/variables/extensionRequestContext.html +3 -2
- package/docs/md/README.md +5 -3
- package/docs/md/classes/CameraKit.md +26 -37
- package/docs/md/classes/CameraKitSession.md +150 -108
- package/docs/md/classes/CameraKitSource.md +46 -37
- package/docs/md/classes/LensPerformanceMeasurement.md +18 -26
- package/docs/md/classes/LensPerformanceMetrics.md +8 -10
- package/docs/md/classes/LensRepository.md +66 -45
- package/docs/md/classes/Transform2D.md +19 -26
- package/docs/md/classes/TypedCustomEvent.md +24 -32
- package/docs/md/classes/TypedEventTarget.md +43 -54
- package/docs/md/enumerations/Lens_CameraFacing.md +31 -0
- package/docs/md/functions/bootstrapCameraKit.md +66 -0
- package/docs/md/functions/createExtension.md +50 -0
- package/docs/md/functions/createImageSource.md +30 -0
- package/docs/md/functions/createMediaStreamSource.md +30 -0
- package/docs/md/functions/createVideoSource.md +31 -0
- package/docs/md/functions/estimateLensPerformance.md +18 -0
- package/docs/md/functions/filePickerFactory.md +22 -0
- package/docs/md/functions/getExtensionRequestContext.md +21 -0
- package/docs/md/functions/lensSourcesFactory.md +37 -0
- package/docs/md/functions/remoteApiServicesFactory.md +19 -0
- package/docs/md/globals.md +124 -0
- package/docs/md/interfaces/BitmojiUserInfo.md +9 -12
- package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +99 -40
- package/docs/md/interfaces/CameraKitDeviceOptions.md +11 -17
- package/docs/md/interfaces/CameraKitSourceInfo.md +14 -20
- package/docs/md/interfaces/CameraKitSourceSubscriber.md +23 -28
- package/docs/md/interfaces/ComputedFrameMetrics.md +13 -19
- package/docs/md/interfaces/CreateSessionOptions.md +10 -13
- package/docs/md/interfaces/EstimatedLensPerformance.md +10 -14
- package/docs/md/interfaces/Font.md +25 -0
- package/docs/md/interfaces/FriendUserInfo.md +12 -16
- package/docs/md/interfaces/FunctionSourceOptions.md +6 -8
- package/docs/md/interfaces/Keyboard.md +137 -0
- package/docs/md/interfaces/KeyboardActiveEvent.md +46 -0
- package/docs/md/interfaces/Lens.md +26 -37
- package/docs/md/interfaces/LensCreator.md +6 -8
- package/docs/md/interfaces/LensHttpRequest.md +60 -0
- package/docs/md/interfaces/LensLaunchData.md +13 -17
- package/docs/md/interfaces/LensSource.md +26 -27
- package/docs/md/interfaces/LensUserData.md +30 -40
- package/docs/md/interfaces/LoadAssetRequest.md +13 -18
- package/docs/md/interfaces/MediaStreamSourceOptions.md +15 -22
- package/docs/md/interfaces/Preview.md +6 -8
- package/docs/md/interfaces/RemoteApiRequest.md +12 -17
- package/docs/md/interfaces/RemoteApiResponse.md +10 -14
- package/docs/md/interfaces/RemoteApiService.md +20 -19
- package/docs/md/interfaces/Snapcode.md +8 -11
- package/docs/md/interfaces/UriCancelRequest.md +7 -10
- package/docs/md/interfaces/UriRequest.md +15 -22
- package/docs/md/interfaces/UriResponse.md +14 -20
- package/docs/md/interfaces/VideoSourceOptions.md +13 -19
- package/docs/md/type-aliases/ArgumentValidationError.md +11 -0
- package/docs/md/type-aliases/AssetLoader.md +26 -0
- package/docs/md/type-aliases/AssetResponse.md +9 -0
- package/docs/md/type-aliases/AssetTiming.md +18 -0
- package/docs/md/type-aliases/BenchmarkError.md +9 -0
- package/docs/md/type-aliases/BootstrapError.md +12 -0
- package/docs/md/type-aliases/CacheKeyNotFoundError.md +9 -0
- package/docs/md/type-aliases/CameraKitSessionEventListener.md +11 -0
- package/docs/md/type-aliases/CameraKitSessionEvents.md +17 -0
- package/docs/md/type-aliases/CameraKitSourceError.md +9 -0
- package/docs/md/type-aliases/ConfigurationError.md +11 -0
- package/docs/md/type-aliases/FetchHandler.md +27 -0
- package/docs/md/type-aliases/FilePicker.md +32 -0
- package/docs/md/type-aliases/FilePickerOptions.md +11 -0
- package/docs/md/type-aliases/FilePickerResult.md +11 -0
- package/docs/md/type-aliases/KeyboardEventListener.md +11 -0
- package/docs/md/type-aliases/KeyboardEvents.md +11 -0
- package/docs/md/type-aliases/LegalError.md +9 -0
- package/docs/md/type-aliases/LensAbortError.md +22 -0
- package/docs/md/type-aliases/LensAssetError.md +11 -0
- package/docs/md/type-aliases/LensContentValidationError.md +9 -0
- package/docs/md/type-aliases/LensError.md +9 -0
- package/docs/md/type-aliases/LensExecutionError.md +23 -0
- package/docs/md/type-aliases/LensHttpHandler.md +41 -0
- package/docs/md/type-aliases/LensImagePickerError.md +12 -0
- package/docs/md/type-aliases/LensLaunchParams.md +11 -0
- package/docs/md/type-aliases/LensMetricsEvents.md +13 -0
- package/docs/md/type-aliases/LensPerformanceCluster.md +9 -0
- package/docs/md/type-aliases/LensView.md +21 -0
- package/docs/md/type-aliases/LensWait.md +13 -0
- package/docs/md/type-aliases/Matrix.md +12 -0
- package/docs/md/type-aliases/PersistentStoreError.md +11 -0
- package/docs/md/type-aliases/PlatformNotSupportedError.md +13 -0
- package/docs/md/type-aliases/PublicContainer.md +12 -0
- package/docs/md/type-aliases/PublicServices.md +11 -0
- package/docs/md/type-aliases/RemoteApiCancelRequestHandler.md +15 -0
- package/docs/md/type-aliases/RemoteApiRequestHandler.md +24 -0
- package/docs/md/type-aliases/RemoteApiServices.md +9 -0
- package/docs/md/type-aliases/RemoteApiStatus.md +11 -0
- package/docs/md/type-aliases/RenderTarget.md +14 -0
- package/docs/md/type-aliases/Uri.md +9 -0
- package/docs/md/type-aliases/WebGLError.md +9 -0
- package/docs/md/type-aliases/Zodiac.md +9 -0
- package/docs/md/variables/extensionRequestContext.md +15 -0
- package/package.json +5 -5
- package/dist/extensions/RemoteApiServices.d.ts.map +0 -1
- package/dist/extensions/RemoteApiServices.js +0 -159
- package/dist/extensions/RemoteApiServices.js.map +0 -1
- package/dist/extensions/UriHandlers.d.ts.map +0 -1
- package/dist/extensions/UriHandlers.js.map +0 -1
- package/dist/extensions/uriHandlersRegister.d.ts.map +0 -1
- package/dist/extensions/uriHandlersRegister.js.map +0 -1
- package/docs/html/types/Keyboard.html +0 -26
- package/docs/md/.nojekyll +0 -1
- package/docs/md/enums/Lens_CameraFacing.md +0 -36
- package/docs/md/modules.md +0 -904
- /package/dist/{extensions → uri-handlers}/UriHandlers.d.ts +0 -0
- /package/dist/{extensions → uri-handlers}/UriHandlers.js +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / bootstrapCameraKit
|
|
6
|
+
|
|
7
|
+
# Function: bootstrapCameraKit()
|
|
8
|
+
|
|
9
|
+
> **bootstrapCameraKit**(`configuration`, `provide`?): `Promise`\<[`CameraKit`](../classes/CameraKit.md)\>
|
|
10
|
+
|
|
11
|
+
Bootstrap CameraKit. This will download the WebAssembly code which powers CameraKit's rendering engine, and return
|
|
12
|
+
an instance of [CameraKit](../classes/CameraKit.md).
|
|
13
|
+
|
|
14
|
+
CameraKit must be provided with some configuration (the application's API token), and there are some additional
|
|
15
|
+
configurations which are optional.
|
|
16
|
+
|
|
17
|
+
Descriptions of the available configurations can be found in the documentation for
|
|
18
|
+
[CameraKitBootstrapConfiguration](../interfaces/CameraKitBootstrapConfiguration.md)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
There is also a second, more advanced way to modify CameraKit to provide greater flexibility to support less common
|
|
23
|
+
use cases.
|
|
24
|
+
|
|
25
|
+
This requires some knowledge of CameraKit's dependency injection system, and allows applications to provide their
|
|
26
|
+
own custom implementations of certain CameraKit components. This functionality will only be needed by applications
|
|
27
|
+
with very specific, more advanced requirements.
|
|
28
|
+
|
|
29
|
+
## Parameters
|
|
30
|
+
|
|
31
|
+
### configuration
|
|
32
|
+
|
|
33
|
+
[`CameraKitBootstrapConfiguration`](../interfaces/CameraKitBootstrapConfiguration.md)
|
|
34
|
+
|
|
35
|
+
Configure CameraKit with e.g. credentials, global resource endpoints, etc.
|
|
36
|
+
|
|
37
|
+
### provide?
|
|
38
|
+
|
|
39
|
+
(`c`) => [`PublicContainer`](../type-aliases/PublicContainer.md)
|
|
40
|
+
|
|
41
|
+
Optional function that can make modifications to CameraKit's root DI container.
|
|
42
|
+
|
|
43
|
+
## Returns
|
|
44
|
+
|
|
45
|
+
`Promise`\<[`CameraKit`](../classes/CameraKit.md)\>
|
|
46
|
+
|
|
47
|
+
A [CameraKit](../classes/CameraKit.md) instance, which is the entry point to CameraKit's API.
|
|
48
|
+
|
|
49
|
+
## Example
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// The most common way to bootstrap:
|
|
53
|
+
const cameraKit = await bootstrapCameraKit({ apiToken: myApiToken })
|
|
54
|
+
|
|
55
|
+
// For special advanced use-cases, it is possible to provide custom implementations for certain CameraKit components.
|
|
56
|
+
const cameraKit = await bootstrapCameraKit(config, (container) => {
|
|
57
|
+
return container.provides(myCustomRemoteMediaAssetLoaderFactory)
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Throws
|
|
62
|
+
|
|
63
|
+
- [ConfigurationError](../type-aliases/ConfigurationError.md) when provided configuration object is invalid
|
|
64
|
+
- [PlatformNotSupportedError](../type-aliases/PlatformNotSupportedError.md) when current platform is not supported by CameraKit
|
|
65
|
+
- [BootstrapError](../type-aliases/BootstrapError.md) when a failure occurs while initializing CameraKit and downloading the render engine
|
|
66
|
+
WebAssembly binary.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / createExtension
|
|
6
|
+
|
|
7
|
+
# Function: createExtension()
|
|
8
|
+
|
|
9
|
+
> **createExtension**(): `PartialContainer`
|
|
10
|
+
|
|
11
|
+
Extensions offer a way to provide custom implementations of certain parts of the CameraKit SDK.
|
|
12
|
+
|
|
13
|
+
This enables more advanced use-cases, in which the default behavior of the SDK is substantially altered. For example,
|
|
14
|
+
replacing the default implementation that loads remote lens assets with a custom implementation that returns
|
|
15
|
+
different assets based on some business logic within the application.
|
|
16
|
+
|
|
17
|
+
An extension is implemented as a PartialContainer – a collection of factory functions, each with its own
|
|
18
|
+
dependencies, which each provide some "Service". A Service can be of any type, and the CameraKit SDK defines its
|
|
19
|
+
own Services, some of which can be overridden by providing a custom implementation of the type via an extension.
|
|
20
|
+
|
|
21
|
+
Here's an example of how extensions might be used:
|
|
22
|
+
```ts
|
|
23
|
+
import { bootstrapCameraKit, createExtension, remoteMediaAssetLoaderFactory } from '@snap/camera-kit'
|
|
24
|
+
|
|
25
|
+
const myCustomRemoteAssetLoader = Injectable(
|
|
26
|
+
remoteMediaAssetLoaderFactory.token,
|
|
27
|
+
[remoteMediaAssetLoaderFactory.token] as const,
|
|
28
|
+
(defaultLoader: AssetLoader): AssetLoader => {
|
|
29
|
+
return async (asset, lens) => {
|
|
30
|
+
if (lens?.id === MY_SPECIAL_LENS) {
|
|
31
|
+
return (await fetch('my/asset.glb')).arrayBuffer()
|
|
32
|
+
}
|
|
33
|
+
return defaultLoader(asset, lens)
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
const myExtension = createExtension().provides(myCustomRemoteAssetLoader);
|
|
39
|
+
const cameraKit = bootstrapCameraKit(config, container => container.provides(myExtension));
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This also enables greater modularity – the person/team creating the extension can do so in their own package, which
|
|
43
|
+
could be shared by many applications that all require the same functionality.
|
|
44
|
+
|
|
45
|
+
## Returns
|
|
46
|
+
|
|
47
|
+
`PartialContainer`
|
|
48
|
+
|
|
49
|
+
A PartialContainer which can be used to create a collection of Services, and can later be provided
|
|
50
|
+
to CameraKit's DI container during [bootstrapCameraKit](bootstrapCameraKit.md).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / createImageSource
|
|
6
|
+
|
|
7
|
+
# Function: createImageSource()
|
|
8
|
+
|
|
9
|
+
> **createImageSource**(`image`, `options`): [`CameraKitSource`](../classes/CameraKitSource.md)
|
|
10
|
+
|
|
11
|
+
Create a [CameraKitSource](../classes/CameraKitSource.md) from an
|
|
12
|
+
[HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement).
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### image
|
|
17
|
+
|
|
18
|
+
`HTMLImageElement`
|
|
19
|
+
|
|
20
|
+
Image element.
|
|
21
|
+
|
|
22
|
+
### options
|
|
23
|
+
|
|
24
|
+
`Partial`\<[`CameraKitDeviceOptions`](../interfaces/CameraKitDeviceOptions.md)\> = `{}`
|
|
25
|
+
|
|
26
|
+
Options.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
[`CameraKitSource`](../classes/CameraKitSource.md)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / createMediaStreamSource
|
|
6
|
+
|
|
7
|
+
# Function: createMediaStreamSource()
|
|
8
|
+
|
|
9
|
+
> **createMediaStreamSource**(`stream`, `options`): [`CameraKitSource`](../classes/CameraKitSource.md)
|
|
10
|
+
|
|
11
|
+
Create a [CameraKitSource](../classes/CameraKitSource.md) from any
|
|
12
|
+
[MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream).
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### stream
|
|
17
|
+
|
|
18
|
+
`MediaStream`
|
|
19
|
+
|
|
20
|
+
Any MediaStream, such as obtained via `canvas.captureStream()` or `mediaDevices.getUserMedia()`.
|
|
21
|
+
|
|
22
|
+
### options
|
|
23
|
+
|
|
24
|
+
`Partial`\<[`MediaStreamSourceOptions`](../interfaces/MediaStreamSourceOptions.md)\> = `{}`
|
|
25
|
+
|
|
26
|
+
Options.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
[`CameraKitSource`](../classes/CameraKitSource.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / createVideoSource
|
|
6
|
+
|
|
7
|
+
# Function: createVideoSource()
|
|
8
|
+
|
|
9
|
+
> **createVideoSource**(`video`, `options`): [`CameraKitSource`](../classes/CameraKitSource.md)
|
|
10
|
+
|
|
11
|
+
Create a [CameraKitSource](../classes/CameraKitSource.md) from an
|
|
12
|
+
[HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### video
|
|
17
|
+
|
|
18
|
+
`HTMLVideoElement`
|
|
19
|
+
|
|
20
|
+
CameraKit performs best when the source video is 720p – arbitrary resolutions are supported, but very
|
|
21
|
+
high resolutions may not perform well.
|
|
22
|
+
|
|
23
|
+
### options
|
|
24
|
+
|
|
25
|
+
`Partial`\<[`VideoSourceOptions`](../interfaces/VideoSourceOptions.md)\> = `{}`
|
|
26
|
+
|
|
27
|
+
Options.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
[`CameraKitSource`](../classes/CameraKitSource.md)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / estimateLensPerformance
|
|
6
|
+
|
|
7
|
+
# Function: estimateLensPerformance()
|
|
8
|
+
|
|
9
|
+
> **estimateLensPerformance**(): `Promise`\<[`EstimatedLensPerformance`](../interfaces/EstimatedLensPerformance.md)\>
|
|
10
|
+
|
|
11
|
+
Run benchmarks which attempt to predict expected lens performance, and assign a cluster (i.e. a performance rating)
|
|
12
|
+
which the CameraKit SDK can use to optimize certain lenses.
|
|
13
|
+
|
|
14
|
+
## Returns
|
|
15
|
+
|
|
16
|
+
`Promise`\<[`EstimatedLensPerformance`](../interfaces/EstimatedLensPerformance.md)\>
|
|
17
|
+
|
|
18
|
+
A rating from 1-6, indicating expected Lens performance.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / filePickerFactory
|
|
6
|
+
|
|
7
|
+
# Function: filePickerFactory()
|
|
8
|
+
|
|
9
|
+
> **filePickerFactory**(...`args`): [`FilePicker`](../type-aliases/FilePicker.md)
|
|
10
|
+
|
|
11
|
+
Default file picker factory function. The file picker is triggered when a lens issues a file request.
|
|
12
|
+
Client applications can override this factory function to provide their custom file picker.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### args
|
|
17
|
+
|
|
18
|
+
...[]
|
|
19
|
+
|
|
20
|
+
## Returns
|
|
21
|
+
|
|
22
|
+
[`FilePicker`](../type-aliases/FilePicker.md)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / getExtensionRequestContext
|
|
6
|
+
|
|
7
|
+
# Function: getExtensionRequestContext()
|
|
8
|
+
|
|
9
|
+
> **getExtensionRequestContext**(...`args`): `ArrayBuffer`
|
|
10
|
+
|
|
11
|
+
Returns extension request context.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
### args
|
|
16
|
+
|
|
17
|
+
...[]
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`ArrayBuffer`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / lensSourcesFactory
|
|
6
|
+
|
|
7
|
+
# Function: lensSourcesFactory()
|
|
8
|
+
|
|
9
|
+
> **lensSourcesFactory**(...`args`): [`LensSource`](../interfaces/LensSource.md)[]
|
|
10
|
+
|
|
11
|
+
By default, no custom [LensSource](../interfaces/LensSource.md) is provided to CameraKit. But to enable certain advanced use-cases,
|
|
12
|
+
applications may provide their own [LensSource](../interfaces/LensSource.md).
|
|
13
|
+
|
|
14
|
+
Perhaps the most convenient way to do this is with ConcatInjectable, as shown here:
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
### args
|
|
19
|
+
|
|
20
|
+
...[]
|
|
21
|
+
|
|
22
|
+
## Returns
|
|
23
|
+
|
|
24
|
+
[`LensSource`](../interfaces/LensSource.md)[]
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { bootstrapCameraKit, lensSourcesFactory, LensSource } from '@snap/camera-kit'
|
|
30
|
+
|
|
31
|
+
const cameraKit = bootstrapCameraKit(config, (container) => {
|
|
32
|
+
return container.provides(ConcatInjectable(
|
|
33
|
+
lensSourcesFactory.token,
|
|
34
|
+
(): LensSource => { return ... }
|
|
35
|
+
))
|
|
36
|
+
})
|
|
37
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / remoteApiServicesFactory
|
|
6
|
+
|
|
7
|
+
# Function: remoteApiServicesFactory()
|
|
8
|
+
|
|
9
|
+
> **remoteApiServicesFactory**(...`args`): [`RemoteApiServices`](../type-aliases/RemoteApiServices.md)
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
### args
|
|
14
|
+
|
|
15
|
+
...[]
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
[`RemoteApiServices`](../type-aliases/RemoteApiServices.md)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# CameraKit Web SDK v1.2.0
|
|
6
|
+
|
|
7
|
+
## Bootstrapping and Configuration
|
|
8
|
+
|
|
9
|
+
- [EstimatedLensPerformance](interfaces/EstimatedLensPerformance.md)
|
|
10
|
+
- [CameraKitBootstrapConfiguration](interfaces/CameraKitBootstrapConfiguration.md)
|
|
11
|
+
- [LensPerformanceCluster](type-aliases/LensPerformanceCluster.md)
|
|
12
|
+
- [PublicContainer](type-aliases/PublicContainer.md)
|
|
13
|
+
- [ConfigurationError](type-aliases/ConfigurationError.md)
|
|
14
|
+
- [PlatformNotSupportedError](type-aliases/PlatformNotSupportedError.md)
|
|
15
|
+
- [BootstrapError](type-aliases/BootstrapError.md)
|
|
16
|
+
- [estimateLensPerformance](functions/estimateLensPerformance.md)
|
|
17
|
+
- [bootstrapCameraKit](functions/bootstrapCameraKit.md)
|
|
18
|
+
- [createExtension](functions/createExtension.md)
|
|
19
|
+
|
|
20
|
+
## Lenses
|
|
21
|
+
|
|
22
|
+
- [CameraKit](classes/CameraKit.md)
|
|
23
|
+
- [LensRepository](classes/LensRepository.md)
|
|
24
|
+
- [CameraKitSession](classes/CameraKitSession.md)
|
|
25
|
+
- [Lens](interfaces/Lens.md)
|
|
26
|
+
- [LensLaunchData](interfaces/LensLaunchData.md)
|
|
27
|
+
- [LoadAssetRequest](interfaces/LoadAssetRequest.md)
|
|
28
|
+
- [Keyboard](interfaces/Keyboard.md)
|
|
29
|
+
- [LensMetricsEvents](type-aliases/LensMetricsEvents.md)
|
|
30
|
+
- [AssetTiming](type-aliases/AssetTiming.md)
|
|
31
|
+
- [AssetLoader](type-aliases/AssetLoader.md)
|
|
32
|
+
- [LensView](type-aliases/LensView.md)
|
|
33
|
+
- [LensWait](type-aliases/LensWait.md)
|
|
34
|
+
- [RenderTarget](type-aliases/RenderTarget.md)
|
|
35
|
+
- [CameraKitSessionEvents](type-aliases/CameraKitSessionEvents.md)
|
|
36
|
+
|
|
37
|
+
## Metrics
|
|
38
|
+
|
|
39
|
+
- [LensPerformanceMeasurement](classes/LensPerformanceMeasurement.md)
|
|
40
|
+
- [LensPerformanceMetrics](classes/LensPerformanceMetrics.md)
|
|
41
|
+
- [ComputedFrameMetrics](interfaces/ComputedFrameMetrics.md)
|
|
42
|
+
- [LensMetricsEvents](type-aliases/LensMetricsEvents.md)
|
|
43
|
+
- [LensView](type-aliases/LensView.md)
|
|
44
|
+
- [LensWait](type-aliases/LensWait.md)
|
|
45
|
+
|
|
46
|
+
## Other
|
|
47
|
+
|
|
48
|
+
- [Lens\_CameraFacing](enumerations/Lens_CameraFacing.md)
|
|
49
|
+
- [TypedCustomEvent](classes/TypedCustomEvent.md)
|
|
50
|
+
- [TypedEventTarget](classes/TypedEventTarget.md)
|
|
51
|
+
- [Font](interfaces/Font.md)
|
|
52
|
+
- [LensHttpRequest](interfaces/LensHttpRequest.md)
|
|
53
|
+
- [UriRequest](interfaces/UriRequest.md)
|
|
54
|
+
- [UriResponse](interfaces/UriResponse.md)
|
|
55
|
+
- [UriCancelRequest](interfaces/UriCancelRequest.md)
|
|
56
|
+
- [LensCreator](interfaces/LensCreator.md)
|
|
57
|
+
- [Preview](interfaces/Preview.md)
|
|
58
|
+
- [Snapcode](interfaces/Snapcode.md)
|
|
59
|
+
- [LensUserData](interfaces/LensUserData.md)
|
|
60
|
+
- [BitmojiUserInfo](interfaces/BitmojiUserInfo.md)
|
|
61
|
+
- [FriendUserInfo](interfaces/FriendUserInfo.md)
|
|
62
|
+
- [LensSource](interfaces/LensSource.md)
|
|
63
|
+
- [FunctionSourceOptions](interfaces/FunctionSourceOptions.md)
|
|
64
|
+
- [KeyboardActiveEvent](interfaces/KeyboardActiveEvent.md)
|
|
65
|
+
- [RemoteApiRequest](interfaces/RemoteApiRequest.md)
|
|
66
|
+
- [RemoteApiResponse](interfaces/RemoteApiResponse.md)
|
|
67
|
+
- [RemoteApiService](interfaces/RemoteApiService.md)
|
|
68
|
+
- [PublicServices](type-aliases/PublicServices.md)
|
|
69
|
+
- [LensHttpHandler](type-aliases/LensHttpHandler.md)
|
|
70
|
+
- [FetchHandler](type-aliases/FetchHandler.md)
|
|
71
|
+
- [FilePickerOptions](type-aliases/FilePickerOptions.md)
|
|
72
|
+
- [FilePickerResult](type-aliases/FilePickerResult.md)
|
|
73
|
+
- [FilePicker](type-aliases/FilePicker.md)
|
|
74
|
+
- [Uri](type-aliases/Uri.md)
|
|
75
|
+
- [LensLaunchParams](type-aliases/LensLaunchParams.md)
|
|
76
|
+
- [Zodiac](type-aliases/Zodiac.md)
|
|
77
|
+
- [AssetResponse](type-aliases/AssetResponse.md)
|
|
78
|
+
- [LegalError](type-aliases/LegalError.md)
|
|
79
|
+
- [LensContentValidationError](type-aliases/LensContentValidationError.md)
|
|
80
|
+
- [LensError](type-aliases/LensError.md)
|
|
81
|
+
- [CameraKitSourceError](type-aliases/CameraKitSourceError.md)
|
|
82
|
+
- [LensImagePickerError](type-aliases/LensImagePickerError.md)
|
|
83
|
+
- [CacheKeyNotFoundError](type-aliases/CacheKeyNotFoundError.md)
|
|
84
|
+
- [WebGLError](type-aliases/WebGLError.md)
|
|
85
|
+
- [BenchmarkError](type-aliases/BenchmarkError.md)
|
|
86
|
+
- [LensExecutionError](type-aliases/LensExecutionError.md)
|
|
87
|
+
- [LensAbortError](type-aliases/LensAbortError.md)
|
|
88
|
+
- [PersistentStoreError](type-aliases/PersistentStoreError.md)
|
|
89
|
+
- [LensAssetError](type-aliases/LensAssetError.md)
|
|
90
|
+
- [ArgumentValidationError](type-aliases/ArgumentValidationError.md)
|
|
91
|
+
- [CameraKitSessionEventListener](type-aliases/CameraKitSessionEventListener.md)
|
|
92
|
+
- [KeyboardEvents](type-aliases/KeyboardEvents.md)
|
|
93
|
+
- [KeyboardEventListener](type-aliases/KeyboardEventListener.md)
|
|
94
|
+
- [Matrix](type-aliases/Matrix.md)
|
|
95
|
+
- [RemoteApiStatus](type-aliases/RemoteApiStatus.md)
|
|
96
|
+
- [RemoteApiCancelRequestHandler](type-aliases/RemoteApiCancelRequestHandler.md)
|
|
97
|
+
- [RemoteApiRequestHandler](type-aliases/RemoteApiRequestHandler.md)
|
|
98
|
+
- [RemoteApiServices](type-aliases/RemoteApiServices.md)
|
|
99
|
+
- [extensionRequestContext](variables/extensionRequestContext.md)
|
|
100
|
+
- [getExtensionRequestContext](functions/getExtensionRequestContext.md)
|
|
101
|
+
- [filePickerFactory](functions/filePickerFactory.md)
|
|
102
|
+
- [lensSourcesFactory](functions/lensSourcesFactory.md)
|
|
103
|
+
- [remoteApiServicesFactory](functions/remoteApiServicesFactory.md)
|
|
104
|
+
|
|
105
|
+
## Rendering
|
|
106
|
+
|
|
107
|
+
- [CameraKit](classes/CameraKit.md)
|
|
108
|
+
- [CameraKitSource](classes/CameraKitSource.md)
|
|
109
|
+
- [CameraKitSession](classes/CameraKitSession.md)
|
|
110
|
+
- [LensPerformanceMeasurement](classes/LensPerformanceMeasurement.md)
|
|
111
|
+
- [LensPerformanceMetrics](classes/LensPerformanceMetrics.md)
|
|
112
|
+
- [Transform2D](classes/Transform2D.md)
|
|
113
|
+
- [CreateSessionOptions](interfaces/CreateSessionOptions.md)
|
|
114
|
+
- [CameraKitSourceSubscriber](interfaces/CameraKitSourceSubscriber.md)
|
|
115
|
+
- [CameraKitDeviceOptions](interfaces/CameraKitDeviceOptions.md)
|
|
116
|
+
- [CameraKitSourceInfo](interfaces/CameraKitSourceInfo.md)
|
|
117
|
+
- [MediaStreamSourceOptions](interfaces/MediaStreamSourceOptions.md)
|
|
118
|
+
- [VideoSourceOptions](interfaces/VideoSourceOptions.md)
|
|
119
|
+
- [ComputedFrameMetrics](interfaces/ComputedFrameMetrics.md)
|
|
120
|
+
- [RenderTarget](type-aliases/RenderTarget.md)
|
|
121
|
+
- [CameraKitSessionEvents](type-aliases/CameraKitSessionEvents.md)
|
|
122
|
+
- [createImageSource](functions/createImageSource.md)
|
|
123
|
+
- [createMediaStreamSource](functions/createMediaStreamSource.md)
|
|
124
|
+
- [createVideoSource](functions/createVideoSource.md)
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
[CameraKit Web SDK
|
|
1
|
+
[**CameraKit Web SDK v1.2.0**](../README.md)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
3
|
+
***
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
[CameraKit Web SDK](../globals.md) / BitmojiUserInfo
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
- [selfieId](BitmojiUserInfo.md#selfieid)
|
|
7
|
+
# Interface: BitmojiUserInfo
|
|
11
8
|
|
|
12
9
|
## Properties
|
|
13
10
|
|
|
14
|
-
### avatarId
|
|
11
|
+
### avatarId?
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
> `optional` **avatarId**: `string`
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
***
|
|
19
16
|
|
|
20
|
-
### selfieId
|
|
17
|
+
### selfieId?
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
> `optional` **selfieId**: `string`
|