@snap/camera-kit 0.7.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/LICENSE.md +6247 -0
- package/README.md +166 -0
- package/docs/html/.nojekyll +1 -0
- package/docs/html/assets/highlight.css +106 -0
- package/docs/html/assets/main.js +54 -0
- package/docs/html/assets/search.js +1 -0
- package/docs/html/assets/style.css +1225 -0
- package/docs/html/assets/widgets.png +0 -0
- package/docs/html/assets/widgets@2x.png +0 -0
- package/docs/html/classes/CameraKit.html +121 -0
- package/docs/html/classes/CameraKitSession.html +347 -0
- package/docs/html/classes/CameraKitSource.html +152 -0
- package/docs/html/classes/LensPerformanceMeasurement.html +115 -0
- package/docs/html/classes/LensPerformanceMetrics.html +76 -0
- package/docs/html/classes/LensRepository.html +171 -0
- package/docs/html/classes/LensSources.html +82 -0
- package/docs/html/classes/Transform2D.html +99 -0
- package/docs/html/classes/TypedCustomEvent.html +109 -0
- package/docs/html/classes/TypedEventTarget.html +146 -0
- package/docs/html/functions/Injectable.html +193 -0
- package/docs/html/functions/bootstrapCameraKit.html +158 -0
- package/docs/html/functions/createExtension.html +127 -0
- package/docs/html/functions/createImageSource.html +123 -0
- package/docs/html/functions/createMediaStreamSource.html +123 -0
- package/docs/html/functions/createUserMediaSource.html +127 -0
- package/docs/html/functions/createVideoSource.html +124 -0
- package/docs/html/functions/estimateLensPerformance.html +116 -0
- package/docs/html/functions/getRequiredBootstrapURLs.html +124 -0
- package/docs/html/functions/lensSourcesFactory.html +116 -0
- package/docs/html/functions/uriHandlersFactory.html +118 -0
- package/docs/html/index.html +208 -0
- package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +132 -0
- package/docs/html/interfaces/CameraKitSourceSubscriber.html +121 -0
- package/docs/html/interfaces/ComputedFrameMetrics.html +70 -0
- package/docs/html/interfaces/CreateSessionOptions.html +77 -0
- package/docs/html/interfaces/EstimatedLensPerformance.html +78 -0
- package/docs/html/interfaces/Lens.html +115 -0
- package/docs/html/interfaces/LensSource.html +113 -0
- package/docs/html/interfaces/MediaStreamSourceOptions.html +65 -0
- package/docs/html/interfaces/UriCancelRequest.html +65 -0
- package/docs/html/interfaces/UriHandler.html +128 -0
- package/docs/html/interfaces/UriRequest.html +80 -0
- package/docs/html/interfaces/UriResponse.html +80 -0
- package/docs/html/interfaces/VideoSourceOptions.html +60 -0
- package/docs/html/modules.html +198 -0
- package/docs/html/types/AssetLoader.html +126 -0
- package/docs/html/types/AssetTiming.html +116 -0
- package/docs/html/types/BenchmarkError.html +107 -0
- package/docs/html/types/BootstrapError.html +110 -0
- package/docs/html/types/CacheKeyNotFoundError.html +107 -0
- package/docs/html/types/CameraKitDeviceInfo.html +114 -0
- package/docs/html/types/CameraKitSessionEventListener.html +109 -0
- package/docs/html/types/CameraKitSessionEvents.html +118 -0
- package/docs/html/types/CameraKitSourceError.html +107 -0
- package/docs/html/types/CameraKitSourceInfo.html +107 -0
- package/docs/html/types/CameraKitSourceOptions.html +113 -0
- package/docs/html/types/ConfigurationError.html +109 -0
- package/docs/html/types/Keyboard.html +196 -0
- package/docs/html/types/KeyboardEvents.html +109 -0
- package/docs/html/types/LegalError.html +107 -0
- package/docs/html/types/LensAssetError.html +109 -0
- package/docs/html/types/LensContentValidationError.html +107 -0
- package/docs/html/types/LensError.html +107 -0
- package/docs/html/types/LensExecutionError.html +114 -0
- package/docs/html/types/LensImagePickerError.html +110 -0
- package/docs/html/types/LensLaunchParams.html +109 -0
- package/docs/html/types/LensMetricsEvents.html +110 -0
- package/docs/html/types/LensPerformanceCluster.html +107 -0
- package/docs/html/types/LensView.html +119 -0
- package/docs/html/types/LensWait.html +111 -0
- package/docs/html/types/PersistentStoreError.html +109 -0
- package/docs/html/types/PlatformNotSupportedError.html +110 -0
- package/docs/html/types/PublicContainer.html +110 -0
- package/docs/html/types/RenderTarget.html +111 -0
- package/docs/html/types/Uri.html +107 -0
- package/docs/html/types/UriHandlers.html +109 -0
- package/docs/html/types/WebGLError.html +107 -0
- package/docs/html/variables/extensionRequestContext.html +109 -0
- package/docs/md/.nojekyll +1 -0
- package/docs/md/README.md +168 -0
- package/docs/md/classes/CameraKit.md +94 -0
- package/docs/md/classes/CameraKitSession.md +359 -0
- package/docs/md/classes/CameraKitSource.md +110 -0
- package/docs/md/classes/LensPerformanceMeasurement.md +77 -0
- package/docs/md/classes/LensPerformanceMetrics.md +37 -0
- package/docs/md/classes/LensRepository.md +145 -0
- package/docs/md/classes/LensSources.md +29 -0
- package/docs/md/classes/Transform2D.md +55 -0
- package/docs/md/classes/TypedCustomEvent.md +65 -0
- package/docs/md/classes/TypedEventTarget.md +103 -0
- package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +106 -0
- package/docs/md/interfaces/CameraKitSourceSubscriber.md +55 -0
- package/docs/md/interfaces/ComputedFrameMetrics.md +29 -0
- package/docs/md/interfaces/CreateSessionOptions.md +35 -0
- package/docs/md/interfaces/EstimatedLensPerformance.md +38 -0
- package/docs/md/interfaces/Lens.md +84 -0
- package/docs/md/interfaces/LensSource.md +68 -0
- package/docs/md/interfaces/MediaStreamSourceOptions.md +22 -0
- package/docs/md/interfaces/UriCancelRequest.md +22 -0
- package/docs/md/interfaces/UriHandler.md +63 -0
- package/docs/md/interfaces/UriRequest.md +43 -0
- package/docs/md/interfaces/UriResponse.md +43 -0
- package/docs/md/interfaces/VideoSourceOptions.md +15 -0
- package/docs/md/modules.md +827 -0
- package/lib/CameraKit.d.ts +170 -0
- package/lib/CameraKit.js +145 -0
- package/lib/CameraKit.js.map +1 -0
- package/lib/__tests__/data.d.ts +9 -0
- package/lib/__tests__/data.js +50 -0
- package/lib/__tests__/data.js.map +1 -0
- package/lib/__tests__/deferred.d.ts +16 -0
- package/lib/__tests__/deferred.js +29 -0
- package/lib/__tests__/deferred.js.map +1 -0
- package/lib/__tests__/jest.matchers.d.ts +17 -0
- package/lib/__tests__/jest.matchers.js +67 -0
- package/lib/__tests__/jest.matchers.js.map +1 -0
- package/lib/assertPlatformSupported.d.ts +4 -0
- package/lib/assertPlatformSupported.js +10 -0
- package/lib/assertPlatformSupported.js.map +1 -0
- package/lib/benchmark/benchmarkGflops.d.ts +16 -0
- package/lib/benchmark/benchmarkGflops.js +129 -0
- package/lib/benchmark/benchmarkGflops.js.map +1 -0
- package/lib/benchmark/estimateLensPerformanceCluster.d.ts +33 -0
- package/lib/benchmark/estimateLensPerformanceCluster.js +48 -0
- package/lib/benchmark/estimateLensPerformanceCluster.js.map +1 -0
- package/lib/benchmark/webglUtils.d.ts +7 -0
- package/lib/benchmark/webglUtils.js +87 -0
- package/lib/benchmark/webglUtils.js.map +1 -0
- package/lib/bootstrapCameraKit.d.ts +96 -0
- package/lib/bootstrapCameraKit.js +204 -0
- package/lib/bootstrapCameraKit.js.map +1 -0
- package/lib/common/__mocks__/loadScript.d.ts +1 -0
- package/lib/common/__mocks__/loadScript.js +10 -0
- package/lib/common/__mocks__/loadScript.js.map +1 -0
- package/lib/common/assertions.d.ts +27 -0
- package/lib/common/assertions.js +39 -0
- package/lib/common/assertions.js.map +1 -0
- package/lib/common/cameraKitUserAgent.d.ts +34 -0
- package/lib/common/cameraKitUserAgent.js +216 -0
- package/lib/common/cameraKitUserAgent.js.map +1 -0
- package/lib/common/copyDefinedProperties.d.ts +13 -0
- package/lib/common/copyDefinedProperties.js +16 -0
- package/lib/common/copyDefinedProperties.js.map +1 -0
- package/lib/common/entries.d.ts +3 -0
- package/lib/common/entries.js +3 -0
- package/lib/common/entries.js.map +1 -0
- package/lib/common/errorHelpers.d.ts +10 -0
- package/lib/common/errorHelpers.js +24 -0
- package/lib/common/errorHelpers.js.map +1 -0
- package/lib/common/getFilename.d.ts +1 -0
- package/lib/common/getFilename.js +4 -0
- package/lib/common/getFilename.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +3 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/loadScript.d.ts +1 -0
- package/lib/common/loadScript.js +11 -0
- package/lib/common/loadScript.js.map +1 -0
- package/lib/common/locale.d.ts +2 -0
- package/lib/common/locale.js +11 -0
- package/lib/common/locale.js.map +1 -0
- package/lib/common/localization.d.ts +43 -0
- package/lib/common/localization.js +43 -0
- package/lib/common/localization.js.map +1 -0
- package/lib/common/memoize.d.ts +8 -0
- package/lib/common/memoize.js +15 -0
- package/lib/common/memoize.js.map +1 -0
- package/lib/common/pageVisibility.d.ts +20 -0
- package/lib/common/pageVisibility.js +62 -0
- package/lib/common/pageVisibility.js.map +1 -0
- package/lib/common/time.d.ts +1 -0
- package/lib/common/time.js +2 -0
- package/lib/common/time.js.map +1 -0
- package/lib/common/typeguards.d.ts +53 -0
- package/lib/common/typeguards.js +92 -0
- package/lib/common/typeguards.js.map +1 -0
- package/lib/common/types.d.ts +10 -0
- package/lib/common/types.js +2 -0
- package/lib/common/types.js.map +1 -0
- package/lib/common/validate.d.ts +14 -0
- package/lib/common/validate.js +104 -0
- package/lib/common/validate.js.map +1 -0
- package/lib/configuration.d.ts +92 -0
- package/lib/configuration.js +36 -0
- package/lib/configuration.js.map +1 -0
- package/lib/configurationOverrides.d.ts +12 -0
- package/lib/configurationOverrides.js +41 -0
- package/lib/configurationOverrides.js.map +1 -0
- package/lib/dependency-injection/Container.d.ts +177 -0
- package/lib/dependency-injection/Container.js +160 -0
- package/lib/dependency-injection/Container.js.map +1 -0
- package/lib/dependency-injection/Injectable.d.ts +39 -0
- package/lib/dependency-injection/Injectable.js +18 -0
- package/lib/dependency-injection/Injectable.js.map +1 -0
- package/lib/dependency-injection/PartialContainer.d.ts +81 -0
- package/lib/dependency-injection/PartialContainer.js +85 -0
- package/lib/dependency-injection/PartialContainer.js.map +1 -0
- package/lib/dependency-injection/RootServices.d.ts +62 -0
- package/lib/dependency-injection/RootServices.js +2 -0
- package/lib/dependency-injection/RootServices.js.map +1 -0
- package/lib/dependency-injection/types.d.ts +56 -0
- package/lib/dependency-injection/types.js +2 -0
- package/lib/dependency-injection/types.js.map +1 -0
- package/lib/environment.json +1 -0
- package/lib/events/TypedCustomEvent.d.ts +10 -0
- package/lib/events/TypedCustomEvent.js +11 -0
- package/lib/events/TypedCustomEvent.js.map +1 -0
- package/lib/events/TypedEventTarget.d.ts +25 -0
- package/lib/events/TypedEventTarget.js +57 -0
- package/lib/events/TypedEventTarget.js.map +1 -0
- package/lib/events/scan.d.ts +15 -0
- package/lib/events/scan.js +46 -0
- package/lib/events/scan.js.map +1 -0
- package/lib/extensions/LensSources.d.ts +58 -0
- package/lib/extensions/LensSources.js +50 -0
- package/lib/extensions/LensSources.js.map +1 -0
- package/lib/extensions/UriHandlers.d.ts +54 -0
- package/lib/extensions/UriHandlers.js +93 -0
- package/lib/extensions/UriHandlers.js.map +1 -0
- package/lib/extensions/extensionRequestContext.d.ts +4 -0
- package/lib/extensions/extensionRequestContext.js +14 -0
- package/lib/extensions/extensionRequestContext.js.map +1 -0
- package/lib/generated-proto/blizzard/cameraKitEvents.d.ts +5603 -0
- package/lib/generated-proto/blizzard/cameraKitEvents.js +522 -0
- package/lib/generated-proto/blizzard/cameraKitEvents.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +98 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js +260 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.d.ts +543 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.js +429 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts +100 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js +164 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +395 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js +644 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts +185 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js +172 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts +86 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js +234 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js.map +1 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.d.ts +854 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.js +629 -0
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.d.ts +86 -0
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.js +185 -0
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark_name.d.ts +95 -0
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark_name.js +104 -0
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark_name.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +10212 -0
- package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.js +1300 -0
- package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.d.ts +401 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.js +525 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_response.d.ts +1287 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_response.js +135 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_response.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.d.ts +4208 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.js +1053 -0
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/debug_info.d.ts +102 -0
- package/lib/generated-proto/pb_schema/cdp/cof/debug_info.js +165 -0
- package/lib/generated-proto/pb_schema/cdp/cof/debug_info.js.map +1 -0
- package/lib/generated-proto/pb_schema/cdp/cof/namespace.d.ts +8 -0
- package/lib/generated-proto/pb_schema/cdp/cof/namespace.js +17 -0
- package/lib/generated-proto/pb_schema/cdp/cof/namespace.js.map +1 -0
- package/lib/generated-proto/pb_schema/common/ruid.d.ts +75 -0
- package/lib/generated-proto/pb_schema/common/ruid.js +96 -0
- package/lib/generated-proto/pb_schema/common/ruid.js.map +1 -0
- package/lib/generated-proto/pb_schema/common/value.d.ts +131 -0
- package/lib/generated-proto/pb_schema/common/value.js +204 -0
- package/lib/generated-proto/pb_schema/common/value.js.map +1 -0
- package/lib/generated-proto/pb_schema/google/api/annotations.d.ts +1 -0
- package/lib/generated-proto/pb_schema/google/api/annotations.js +9 -0
- package/lib/generated-proto/pb_schema/google/api/annotations.js.map +1 -0
- package/lib/generated-proto/pb_schema/google/api/http.d.ts +3636 -0
- package/lib/generated-proto/pb_schema/google/api/http.js +271 -0
- package/lib/generated-proto/pb_schema/google/api/http.js.map +1 -0
- package/lib/generated-proto/pb_schema/google/protobuf/any.d.ts +139 -0
- package/lib/generated-proto/pb_schema/google/protobuf/any.js +94 -0
- package/lib/generated-proto/pb_schema/google/protobuf/any.js.map +1 -0
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.d.ts +50968 -0
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.js +2962 -0
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.js.map +1 -0
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.d.ts +98 -0
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.js +82 -0
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.js.map +1 -0
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.d.ts +173 -0
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.js +332 -0
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/geocircle.d.ts +42 -0
- package/lib/generated-proto/pb_schema/lenses/geocircle.js +52 -0
- package/lib/generated-proto/pb_schema/lenses/geocircle.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/geopoint.d.ts +32 -0
- package/lib/generated-proto/pb_schema/lenses/geopoint.js +50 -0
- package/lib/generated-proto/pb_schema/lenses/geopoint.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/launch_params.d.ts +29 -0
- package/lib/generated-proto/pb_schema/lenses/launch_params.js +43 -0
- package/lib/generated-proto/pb_schema/lenses/launch_params.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/launchdata.d.ts +365 -0
- package/lib/generated-proto/pb_schema/lenses/launchdata.js +216 -0
- package/lib/generated-proto/pb_schema/lenses/launchdata.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/lures.d.ts +113 -0
- package/lib/generated-proto/pb_schema/lenses/lures.js +64 -0
- package/lib/generated-proto/pb_schema/lenses/lures.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/persistent_store.d.ts +29 -0
- package/lib/generated-proto/pb_schema/lenses/persistent_store.js +43 -0
- package/lib/generated-proto/pb_schema/lenses/persistent_store.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/snappable.d.ts +921 -0
- package/lib/generated-proto/pb_schema/lenses/snappable.js +954 -0
- package/lib/generated-proto/pb_schema/lenses/snappable.js.map +1 -0
- package/lib/generated-proto/pb_schema/lenses/user_data.d.ts +247 -0
- package/lib/generated-proto/pb_schema/lenses/user_data.js +362 -0
- package/lib/generated-proto/pb_schema/lenses/user_data.js.map +1 -0
- package/lib/handlers/HandlerChainBuilder.d.ts +95 -0
- package/lib/handlers/HandlerChainBuilder.js +187 -0
- package/lib/handlers/HandlerChainBuilder.js.map +1 -0
- package/lib/handlers/arrayBufferParsingHandler.d.ts +10 -0
- package/lib/handlers/arrayBufferParsingHandler.js +18 -0
- package/lib/handlers/arrayBufferParsingHandler.js.map +1 -0
- package/lib/handlers/batchingHandler.d.ts +25 -0
- package/lib/handlers/batchingHandler.js +79 -0
- package/lib/handlers/batchingHandler.js.map +1 -0
- package/lib/handlers/cameraKitServiceFetchHandlerFactory.d.ts +12 -0
- package/lib/handlers/cameraKitServiceFetchHandlerFactory.js +19 -0
- package/lib/handlers/cameraKitServiceFetchHandlerFactory.js.map +1 -0
- package/lib/handlers/debugHandler.d.ts +8 -0
- package/lib/handlers/debugHandler.js +27 -0
- package/lib/handlers/debugHandler.js.map +1 -0
- package/lib/handlers/defaultFetchHandler.d.ts +15 -0
- package/lib/handlers/defaultFetchHandler.js +29 -0
- package/lib/handlers/defaultFetchHandler.js.map +1 -0
- package/lib/handlers/headersModifyingFetchHandler.d.ts +8 -0
- package/lib/handlers/headersModifyingFetchHandler.js +13 -0
- package/lib/handlers/headersModifyingFetchHandler.js.map +1 -0
- package/lib/handlers/index.d.ts +2 -0
- package/lib/handlers/index.js +3 -0
- package/lib/handlers/index.js.map +1 -0
- package/lib/handlers/mappingHandler.d.ts +15 -0
- package/lib/handlers/mappingHandler.js +65 -0
- package/lib/handlers/mappingHandler.js.map +1 -0
- package/lib/handlers/noCorsRetryingFetchHandler.d.ts +48 -0
- package/lib/handlers/noCorsRetryingFetchHandler.js +94 -0
- package/lib/handlers/noCorsRetryingFetchHandler.js.map +1 -0
- package/lib/handlers/persistingHandler.d.ts +14 -0
- package/lib/handlers/persistingHandler.js +71 -0
- package/lib/handlers/persistingHandler.js.map +1 -0
- package/lib/handlers/rateLimitingHandler.d.ts +20 -0
- package/lib/handlers/rateLimitingHandler.js +43 -0
- package/lib/handlers/rateLimitingHandler.js.map +1 -0
- package/lib/handlers/requestStateEmittingHandler.d.ts +29 -0
- package/lib/handlers/requestStateEmittingHandler.js +43 -0
- package/lib/handlers/requestStateEmittingHandler.js.map +1 -0
- package/lib/handlers/responseCachingHandler.d.ts +27 -0
- package/lib/handlers/responseCachingHandler.js +94 -0
- package/lib/handlers/responseCachingHandler.js.map +1 -0
- package/lib/handlers/retryingHandler.d.ts +37 -0
- package/lib/handlers/retryingHandler.js +73 -0
- package/lib/handlers/retryingHandler.js.map +1 -0
- package/lib/handlers/timeoutHandler.d.ts +18 -0
- package/lib/handlers/timeoutHandler.js +30 -0
- package/lib/handlers/timeoutHandler.js.map +1 -0
- package/lib/index.d.ts +33 -0
- package/lib/index.js +32 -0
- package/lib/index.js.map +1 -0
- package/lib/legal/legalPrompt.d.ts +17 -0
- package/lib/legal/legalPrompt.js +144 -0
- package/lib/legal/legalPrompt.js.map +1 -0
- package/lib/legal/legalState.d.ts +50 -0
- package/lib/legal/legalState.js +149 -0
- package/lib/legal/legalState.js.map +1 -0
- package/lib/lens/Lens.d.ts +71 -0
- package/lib/lens/Lens.js +63 -0
- package/lib/lens/Lens.js.map +1 -0
- package/lib/lens/LensLaunchParams.d.ts +19 -0
- package/lib/lens/LensLaunchParams.js +38 -0
- package/lib/lens/LensLaunchParams.js.map +1 -0
- package/lib/lens/LensPersistenceStore.d.ts +7 -0
- package/lib/lens/LensPersistenceStore.js +20 -0
- package/lib/lens/LensPersistenceStore.js.map +1 -0
- package/lib/lens/LensRepository.d.ts +134 -0
- package/lib/lens/LensRepository.js +239 -0
- package/lib/lens/LensRepository.js.map +1 -0
- package/lib/lens/assets/LensAssetRepository.d.ts +66 -0
- package/lib/lens/assets/LensAssetRepository.js +179 -0
- package/lib/lens/assets/LensAssetRepository.js.map +1 -0
- package/lib/lens/assets/LensAssetsProvider.d.ts +21 -0
- package/lib/lens/assets/LensAssetsProvider.js +41 -0
- package/lib/lens/assets/LensAssetsProvider.js.map +1 -0
- package/lib/lens/assets/deviceDependentAssetLoader.d.ts +11 -0
- package/lib/lens/assets/deviceDependentAssetLoader.js +58 -0
- package/lib/lens/assets/deviceDependentAssetLoader.js.map +1 -0
- package/lib/lens/assets/remoteMediaAssetLoaderFactory.d.ts +10 -0
- package/lib/lens/assets/remoteMediaAssetLoaderFactory.js +26 -0
- package/lib/lens/assets/remoteMediaAssetLoaderFactory.js.map +1 -0
- package/lib/lens/assets/staticAssetLoader.d.ts +10 -0
- package/lib/lens/assets/staticAssetLoader.js +24 -0
- package/lib/lens/assets/staticAssetLoader.js.map +1 -0
- package/lib/lens/index.d.ts +7 -0
- package/lib/lens/index.js +7 -0
- package/lib/lens/index.js.map +1 -0
- package/lib/lens/lensEnvelopeUtil.d.ts +5 -0
- package/lib/lens/lensEnvelopeUtil.js +19 -0
- package/lib/lens/lensEnvelopeUtil.js.map +1 -0
- package/lib/lens/lensHttpUtil.d.ts +4 -0
- package/lib/lens/lensHttpUtil.js +30 -0
- package/lib/lens/lensHttpUtil.js.map +1 -0
- package/lib/lens-client-interface/exif.d.ts +20 -0
- package/lib/lens-client-interface/exif.js +61 -0
- package/lib/lens-client-interface/exif.js.map +1 -0
- package/lib/lens-client-interface/imagePicker.d.ts +7 -0
- package/lib/lens-client-interface/imagePicker.js +128 -0
- package/lib/lens-client-interface/imagePicker.js.map +1 -0
- package/lib/lens-client-interface/lensClientInterface.d.ts +13 -0
- package/lib/lens-client-interface/lensClientInterface.js +30 -0
- package/lib/lens-client-interface/lensClientInterface.js.map +1 -0
- package/lib/lens-core-module/generated-types.d.ts +426 -0
- package/lib/lens-core-module/generated-types.js +2 -0
- package/lib/lens-core-module/generated-types.js.map +1 -0
- package/lib/lens-core-module/index.d.ts +2 -0
- package/lib/lens-core-module/index.js +3 -0
- package/lib/lens-core-module/index.js.map +1 -0
- package/lib/lens-core-module/loader/index.d.ts +1 -0
- package/lib/lens-core-module/loader/index.js +2 -0
- package/lib/lens-core-module/loader/index.js.map +1 -0
- package/lib/lens-core-module/loader/lensCoreFactory.d.ts +30 -0
- package/lib/lens-core-module/loader/lensCoreFactory.js +121 -0
- package/lib/lens-core-module/loader/lensCoreFactory.js.map +1 -0
- package/lib/lensCoreWasmVersions.json +5 -0
- package/lib/logger/errorLoggingDecorator.d.ts +9 -0
- package/lib/logger/errorLoggingDecorator.js +32 -0
- package/lib/logger/errorLoggingDecorator.js.map +1 -0
- package/lib/logger/logEntries.d.ts +15 -0
- package/lib/logger/logEntries.js +14 -0
- package/lib/logger/logEntries.js.map +1 -0
- package/lib/logger/logger.d.ts +35 -0
- package/lib/logger/logger.js +48 -0
- package/lib/logger/logger.js.map +1 -0
- package/lib/logger/registerLogEntriesSubscriber.d.ts +14 -0
- package/lib/logger/registerLogEntriesSubscriber.js +23 -0
- package/lib/logger/registerLogEntriesSubscriber.js.map +1 -0
- package/lib/media-sources/CameraKitSource.d.ts +88 -0
- package/lib/media-sources/CameraKitSource.js +140 -0
- package/lib/media-sources/CameraKitSource.js.map +1 -0
- package/lib/media-sources/FunctionSource.d.ts +30 -0
- package/lib/media-sources/FunctionSource.js +132 -0
- package/lib/media-sources/FunctionSource.js.map +1 -0
- package/lib/media-sources/ImageSource.d.ts +13 -0
- package/lib/media-sources/ImageSource.js +28 -0
- package/lib/media-sources/ImageSource.js.map +1 -0
- package/lib/media-sources/MediaStreamSource.d.ts +41 -0
- package/lib/media-sources/MediaStreamSource.js +146 -0
- package/lib/media-sources/MediaStreamSource.js.map +1 -0
- package/lib/media-sources/VideoSource.d.ts +21 -0
- package/lib/media-sources/VideoSource.js +38 -0
- package/lib/media-sources/VideoSource.js.map +1 -0
- package/lib/metrics/businessEventsReporter.d.ts +37 -0
- package/lib/metrics/businessEventsReporter.js +160 -0
- package/lib/metrics/businessEventsReporter.js.map +1 -0
- package/lib/metrics/metricsEventTarget.d.ts +41 -0
- package/lib/metrics/metricsEventTarget.js +11 -0
- package/lib/metrics/metricsEventTarget.js.map +1 -0
- package/lib/metrics/metricsHandler.d.ts +9 -0
- package/lib/metrics/metricsHandler.js +13 -0
- package/lib/metrics/metricsHandler.js.map +1 -0
- package/lib/metrics/operationalMetricsReporter.d.ts +52 -0
- package/lib/metrics/operationalMetricsReporter.js +108 -0
- package/lib/metrics/operationalMetricsReporter.js.map +1 -0
- package/lib/metrics/reporters/reportBenchmarks.d.ts +10 -0
- package/lib/metrics/reporters/reportBenchmarks.js +29 -0
- package/lib/metrics/reporters/reportBenchmarks.js.map +1 -0
- package/lib/metrics/reporters/reportGlobalException.d.ts +19 -0
- package/lib/metrics/reporters/reportGlobalException.js +68 -0
- package/lib/metrics/reporters/reportGlobalException.js.map +1 -0
- package/lib/metrics/reporters/reportHttpMetrics.d.ts +17 -0
- package/lib/metrics/reporters/reportHttpMetrics.js +92 -0
- package/lib/metrics/reporters/reportHttpMetrics.js.map +1 -0
- package/lib/metrics/reporters/reportLegalState.d.ts +15 -0
- package/lib/metrics/reporters/reportLegalState.js +34 -0
- package/lib/metrics/reporters/reportLegalState.js.map +1 -0
- package/lib/metrics/reporters/reportLensAndAssetDownload.d.ts +38 -0
- package/lib/metrics/reporters/reportLensAndAssetDownload.js +88 -0
- package/lib/metrics/reporters/reportLensAndAssetDownload.js.map +1 -0
- package/lib/metrics/reporters/reportLensValidationFailed.d.ts +20 -0
- package/lib/metrics/reporters/reportLensValidationFailed.js +24 -0
- package/lib/metrics/reporters/reportLensValidationFailed.js.map +1 -0
- package/lib/metrics/reporters/reportLensView.d.ts +36 -0
- package/lib/metrics/reporters/reportLensView.js +101 -0
- package/lib/metrics/reporters/reportLensView.js.map +1 -0
- package/lib/metrics/reporters/reportLensWait.d.ts +33 -0
- package/lib/metrics/reporters/reportLensWait.js +56 -0
- package/lib/metrics/reporters/reportLensWait.js.map +1 -0
- package/lib/metrics/reporters/reportSessionException.d.ts +17 -0
- package/lib/metrics/reporters/reportSessionException.js +12 -0
- package/lib/metrics/reporters/reportSessionException.js.map +1 -0
- package/lib/metrics/reporters/reportUserSession.d.ts +14 -0
- package/lib/metrics/reporters/reportUserSession.js +67 -0
- package/lib/metrics/reporters/reportUserSession.js.map +1 -0
- package/lib/metrics/reporters/reporters.d.ts +44 -0
- package/lib/metrics/reporters/reporters.js +33 -0
- package/lib/metrics/reporters/reporters.js.map +1 -0
- package/lib/namedErrors.d.ts +107 -0
- package/lib/namedErrors.js +56 -0
- package/lib/namedErrors.js.map +1 -0
- package/lib/persistence/ExpiringPersistence.d.ts +20 -0
- package/lib/persistence/ExpiringPersistence.js +58 -0
- package/lib/persistence/ExpiringPersistence.js.map +1 -0
- package/lib/persistence/IndexedDBPersistence.d.ts +47 -0
- package/lib/persistence/IndexedDBPersistence.js +180 -0
- package/lib/persistence/IndexedDBPersistence.js.map +1 -0
- package/lib/persistence/Persistence.d.ts +25 -0
- package/lib/persistence/Persistence.js +10 -0
- package/lib/persistence/Persistence.js.map +1 -0
- package/lib/remote-configuration/cofHandler.d.ts +21 -0
- package/lib/remote-configuration/cofHandler.js +75 -0
- package/lib/remote-configuration/cofHandler.js.map +1 -0
- package/lib/remote-configuration/remoteConfiguration.d.ts +13 -0
- package/lib/remote-configuration/remoteConfiguration.js +43 -0
- package/lib/remote-configuration/remoteConfiguration.js.map +1 -0
- package/lib/session/CameraKitSession.d.ts +252 -0
- package/lib/session/CameraKitSession.js +439 -0
- package/lib/session/CameraKitSession.js.map +1 -0
- package/lib/session/CameraKitSessionEvents.d.ts +33 -0
- package/lib/session/CameraKitSessionEvents.js +21 -0
- package/lib/session/CameraKitSessionEvents.js.map +1 -0
- package/lib/session/LensKeyboard.d.ts +89 -0
- package/lib/session/LensKeyboard.js +95 -0
- package/lib/session/LensKeyboard.js.map +1 -0
- package/lib/session/LensPerformanceMeasurement.d.ts +55 -0
- package/lib/session/LensPerformanceMeasurement.js +91 -0
- package/lib/session/LensPerformanceMeasurement.js.map +1 -0
- package/lib/session/LensPerformanceMetrics.d.ts +31 -0
- package/lib/session/LensPerformanceMetrics.js +58 -0
- package/lib/session/LensPerformanceMetrics.js.map +1 -0
- package/lib/session/index.d.ts +1 -0
- package/lib/session/index.js +2 -0
- package/lib/session/index.js.map +1 -0
- package/lib/session/lensState.d.ts +29 -0
- package/lib/session/lensState.js +160 -0
- package/lib/session/lensState.js.map +1 -0
- package/lib/session/sessionState.d.ts +10 -0
- package/lib/session/sessionState.js +12 -0
- package/lib/session/sessionState.js.map +1 -0
- package/lib/transforms/Transform2D.d.ts +17 -0
- package/lib/transforms/Transform2D.js +18 -0
- package/lib/transforms/Transform2D.js.map +1 -0
- package/lib/transforms/index.d.ts +1 -0
- package/lib/transforms/index.js +2 -0
- package/lib/transforms/index.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,827 @@
|
|
|
1
|
+
[CameraKit Web SDK - v0.7.0-alpha.1](README.md) / Exports
|
|
2
|
+
|
|
3
|
+
# CameraKit Web SDK - v0.7.0-alpha.1
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
### Classes
|
|
8
|
+
|
|
9
|
+
- [CameraKit](classes/CameraKit.md)
|
|
10
|
+
- [TypedCustomEvent](classes/TypedCustomEvent.md)
|
|
11
|
+
- [TypedEventTarget](classes/TypedEventTarget.md)
|
|
12
|
+
- [LensSources](classes/LensSources.md)
|
|
13
|
+
- [LensRepository](classes/LensRepository.md)
|
|
14
|
+
- [CameraKitSource](classes/CameraKitSource.md)
|
|
15
|
+
- [CameraKitSession](classes/CameraKitSession.md)
|
|
16
|
+
- [LensPerformanceMeasurement](classes/LensPerformanceMeasurement.md)
|
|
17
|
+
- [LensPerformanceMetrics](classes/LensPerformanceMetrics.md)
|
|
18
|
+
- [Transform2D](classes/Transform2D.md)
|
|
19
|
+
|
|
20
|
+
### Interfaces
|
|
21
|
+
|
|
22
|
+
- [CreateSessionOptions](interfaces/CreateSessionOptions.md)
|
|
23
|
+
- [EstimatedLensPerformance](interfaces/EstimatedLensPerformance.md)
|
|
24
|
+
- [CameraKitBootstrapConfiguration](interfaces/CameraKitBootstrapConfiguration.md)
|
|
25
|
+
- [LensSource](interfaces/LensSource.md)
|
|
26
|
+
- [UriHandler](interfaces/UriHandler.md)
|
|
27
|
+
- [UriRequest](interfaces/UriRequest.md)
|
|
28
|
+
- [UriResponse](interfaces/UriResponse.md)
|
|
29
|
+
- [UriCancelRequest](interfaces/UriCancelRequest.md)
|
|
30
|
+
- [Lens](interfaces/Lens.md)
|
|
31
|
+
- [CameraKitSourceSubscriber](interfaces/CameraKitSourceSubscriber.md)
|
|
32
|
+
- [MediaStreamSourceOptions](interfaces/MediaStreamSourceOptions.md)
|
|
33
|
+
- [VideoSourceOptions](interfaces/VideoSourceOptions.md)
|
|
34
|
+
- [ComputedFrameMetrics](interfaces/ComputedFrameMetrics.md)
|
|
35
|
+
|
|
36
|
+
### Type Aliases
|
|
37
|
+
|
|
38
|
+
- [LensMetricsEvents](modules.md#lensmetricsevents)
|
|
39
|
+
- [LensPerformanceCluster](modules.md#lensperformancecluster)
|
|
40
|
+
- [PublicContainer](modules.md#publiccontainer)
|
|
41
|
+
- [UriHandlers](modules.md#urihandlers)
|
|
42
|
+
- [Uri](modules.md#uri)
|
|
43
|
+
- [LensLaunchParams](modules.md#lenslaunchparams)
|
|
44
|
+
- [AssetTiming](modules.md#assettiming)
|
|
45
|
+
- [AssetLoader](modules.md#assetloader)
|
|
46
|
+
- [CameraKitDeviceInfo](modules.md#camerakitdeviceinfo)
|
|
47
|
+
- [CameraKitSourceInfo](modules.md#camerakitsourceinfo)
|
|
48
|
+
- [CameraKitSourceOptions](modules.md#camerakitsourceoptions)
|
|
49
|
+
- [LensView](modules.md#lensview)
|
|
50
|
+
- [LensWait](modules.md#lenswait)
|
|
51
|
+
- [LegalError](modules.md#legalerror)
|
|
52
|
+
- [LensContentValidationError](modules.md#lenscontentvalidationerror)
|
|
53
|
+
- [LensError](modules.md#lenserror)
|
|
54
|
+
- [CameraKitSourceError](modules.md#camerakitsourceerror)
|
|
55
|
+
- [LensImagePickerError](modules.md#lensimagepickererror)
|
|
56
|
+
- [CacheKeyNotFoundError](modules.md#cachekeynotfounderror)
|
|
57
|
+
- [ConfigurationError](modules.md#configurationerror)
|
|
58
|
+
- [WebGLError](modules.md#webglerror)
|
|
59
|
+
- [BenchmarkError](modules.md#benchmarkerror)
|
|
60
|
+
- [PlatformNotSupportedError](modules.md#platformnotsupportederror)
|
|
61
|
+
- [LensExecutionError](modules.md#lensexecutionerror)
|
|
62
|
+
- [PersistentStoreError](modules.md#persistentstoreerror)
|
|
63
|
+
- [LensAssetError](modules.md#lensasseterror)
|
|
64
|
+
- [BootstrapError](modules.md#bootstraperror)
|
|
65
|
+
- [RenderTarget](modules.md#rendertarget)
|
|
66
|
+
- [CameraKitSessionEvents](modules.md#camerakitsessionevents)
|
|
67
|
+
- [CameraKitSessionEventListener](modules.md#camerakitsessioneventlistener)
|
|
68
|
+
- [KeyboardEvents](modules.md#keyboardevents)
|
|
69
|
+
- [Keyboard](modules.md#keyboard)
|
|
70
|
+
|
|
71
|
+
### Variables
|
|
72
|
+
|
|
73
|
+
- [extensionRequestContext](modules.md#extensionrequestcontext)
|
|
74
|
+
|
|
75
|
+
### Functions
|
|
76
|
+
|
|
77
|
+
- [estimateLensPerformance](modules.md#estimatelensperformance)
|
|
78
|
+
- [bootstrapCameraKit](modules.md#bootstrapcamerakit)
|
|
79
|
+
- [createExtension](modules.md#createextension)
|
|
80
|
+
- [Injectable](modules.md#injectable)
|
|
81
|
+
- [lensSourcesFactory](modules.md#lenssourcesfactory)
|
|
82
|
+
- [uriHandlersFactory](modules.md#urihandlersfactory)
|
|
83
|
+
- [getRequiredBootstrapURLs](modules.md#getrequiredbootstrapurls)
|
|
84
|
+
- [createImageSource](modules.md#createimagesource)
|
|
85
|
+
- [createUserMediaSource](modules.md#createusermediasource)
|
|
86
|
+
- [createMediaStreamSource](modules.md#createmediastreamsource)
|
|
87
|
+
- [createVideoSource](modules.md#createvideosource)
|
|
88
|
+
|
|
89
|
+
## Bootstrapping and Configuration
|
|
90
|
+
|
|
91
|
+
### LensPerformanceCluster
|
|
92
|
+
|
|
93
|
+
Ƭ **LensPerformanceCluster**: ``0`` \| ``1`` \| ``2`` \| ``3`` \| ``4`` \| ``5`` \| ``6``
|
|
94
|
+
|
|
95
|
+
___
|
|
96
|
+
|
|
97
|
+
### PublicContainer
|
|
98
|
+
|
|
99
|
+
Ƭ **PublicContainer**: `Container`<`PublicServices`\>
|
|
100
|
+
|
|
101
|
+
For more advanced use-cases, this DI Container holds services for which a custom implementation may be provided by
|
|
102
|
+
the application.
|
|
103
|
+
|
|
104
|
+
___
|
|
105
|
+
|
|
106
|
+
### ConfigurationError
|
|
107
|
+
|
|
108
|
+
Ƭ **ConfigurationError**: `NamedError`<``"ConfigurationError"``\>
|
|
109
|
+
|
|
110
|
+
Thrown by [bootstrapCameraKit](modules.md#bootstrapcamerakit) if provided configuration is invalid.
|
|
111
|
+
|
|
112
|
+
___
|
|
113
|
+
|
|
114
|
+
### PlatformNotSupportedError
|
|
115
|
+
|
|
116
|
+
Ƭ **PlatformNotSupportedError**: `NamedError`<``"PlatformNotSupportedError"``\>
|
|
117
|
+
|
|
118
|
+
Thrown by [bootstrapCameraKit](modules.md#bootstrapcamerakit) when the current platform is not supported by CameraKit.
|
|
119
|
+
|
|
120
|
+
This can happen if the browser doesn't support a required feature (e.g. WebGL).
|
|
121
|
+
|
|
122
|
+
___
|
|
123
|
+
|
|
124
|
+
### BootstrapError
|
|
125
|
+
|
|
126
|
+
Ƭ **BootstrapError**: `NamedError`<``"BootstrapError"``\>
|
|
127
|
+
|
|
128
|
+
Thrown by [bootstrapCameraKit](modules.md#bootstrapcamerakit) if an error occurs during SDK initializion or while downloading the render
|
|
129
|
+
engine WebAssembly.
|
|
130
|
+
|
|
131
|
+
___
|
|
132
|
+
|
|
133
|
+
### estimateLensPerformance
|
|
134
|
+
|
|
135
|
+
▸ **estimateLensPerformance**(): `Promise`<[`EstimatedLensPerformance`](interfaces/EstimatedLensPerformance.md)\>
|
|
136
|
+
|
|
137
|
+
Run benchmarks which attempt to predict expected lens performance, and assign a cluster (i.e. a performance rating)
|
|
138
|
+
which the CameraKit SDK can use to optimize certain lenses.
|
|
139
|
+
|
|
140
|
+
#### Returns
|
|
141
|
+
|
|
142
|
+
`Promise`<[`EstimatedLensPerformance`](interfaces/EstimatedLensPerformance.md)\>
|
|
143
|
+
|
|
144
|
+
A rating from 1-6, indicating expected Lens performance.
|
|
145
|
+
|
|
146
|
+
___
|
|
147
|
+
|
|
148
|
+
### bootstrapCameraKit
|
|
149
|
+
|
|
150
|
+
▸ **bootstrapCameraKit**(`configuration`, `provide?`): `Promise`<[`CameraKit`](classes/CameraKit.md)\>
|
|
151
|
+
|
|
152
|
+
Bootstrap CameraKit. This will download the WebAssembly code which powers CameraKit's rendering engine, and return
|
|
153
|
+
an instance of [CameraKit](classes/CameraKit.md).
|
|
154
|
+
|
|
155
|
+
CameraKit must be provided with some configuration (the application's API token), and there are some additional
|
|
156
|
+
configurations which are optional.
|
|
157
|
+
|
|
158
|
+
Descriptions of the available configurations can be found in the documentation for
|
|
159
|
+
[CameraKitBootstrapConfiguration](interfaces/CameraKitBootstrapConfiguration.md)
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
There is also a second, more advanced way to modify CameraKit to provide greater flexibility to support less common
|
|
164
|
+
use cases.
|
|
165
|
+
|
|
166
|
+
This requires some knowledge of CameraKit's dependency injection system, and allows applications to provide their
|
|
167
|
+
own custom implementations of certain CameraKit components. This functionality will only be needed by applications
|
|
168
|
+
with very specific, more advanced requirements.
|
|
169
|
+
|
|
170
|
+
**`Example`**
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
// The most common way to bootstrap:
|
|
174
|
+
const cameraKit = await bootstrapCameraKit({ apiToken: myApiToken })
|
|
175
|
+
|
|
176
|
+
// For special advanced use-cases, it is possible to provide custom implementations for certain CameraKit components.
|
|
177
|
+
const cameraKit = await bootstrapCameraKit(config, (container) => {
|
|
178
|
+
return container.provides(myCustomRemoteMediaAssetLoaderFactory)
|
|
179
|
+
})
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**`Throws`**
|
|
183
|
+
|
|
184
|
+
- [ConfigurationError](modules.md#configurationerror) when provided configuration object is invalid
|
|
185
|
+
- [PlatformNotSupportedError](modules.md#platformnotsupportederror) when current platform is not supported by CameraKit
|
|
186
|
+
- [BootstrapError](modules.md#bootstraperror) when a failure occurs while initializing CameraKit and downloading the render engine
|
|
187
|
+
WebAssembly binary.
|
|
188
|
+
|
|
189
|
+
#### Parameters
|
|
190
|
+
|
|
191
|
+
| Name | Type | Description |
|
|
192
|
+
| :------ | :------ | :------ |
|
|
193
|
+
| `configuration` | [`CameraKitBootstrapConfiguration`](interfaces/CameraKitBootstrapConfiguration.md) | Configure CameraKit with e.g. credentials, global resource endpoints, etc. |
|
|
194
|
+
| `provide?` | (`c`: [`PublicContainer`](modules.md#publiccontainer)) => [`PublicContainer`](modules.md#publiccontainer) | Optional function that can make modifications to CameraKit's root DI container. |
|
|
195
|
+
|
|
196
|
+
#### Returns
|
|
197
|
+
|
|
198
|
+
`Promise`<[`CameraKit`](classes/CameraKit.md)\>
|
|
199
|
+
|
|
200
|
+
A [CameraKit](classes/CameraKit.md) instance, which is the entry point to CameraKit's API.
|
|
201
|
+
|
|
202
|
+
___
|
|
203
|
+
|
|
204
|
+
### createExtension
|
|
205
|
+
|
|
206
|
+
▸ **createExtension**(): `PartialContainer`
|
|
207
|
+
|
|
208
|
+
Extensions offer a way to provide custom implementations of certain parts of the CameraKit SDK.
|
|
209
|
+
|
|
210
|
+
This enables more advanced use-cases, in which the default behavior of the SDK is substantially altered. For example,
|
|
211
|
+
replacing the default implementation that loads remote lens assets with a custom implementation that returns
|
|
212
|
+
different assets based on some business logic within the application.
|
|
213
|
+
|
|
214
|
+
An extension is implemented as a [PartialContainer] – a collection of factory functions, each with its own
|
|
215
|
+
dependencies, which each provide some "Service." A Service can be of any type, and the CameraKit SDK defines its
|
|
216
|
+
own Services, some of which can be overridden by providing a custom implementation of the type via an extension.
|
|
217
|
+
|
|
218
|
+
Here's an example of how extensions might be used:
|
|
219
|
+
```ts
|
|
220
|
+
import { bootstrapCameraKit, createExtension, remoteMediaAssetLoaderFactory } from '@snap/camera-kit'
|
|
221
|
+
|
|
222
|
+
const myCustomRemoteAssetLoader = Injectable(
|
|
223
|
+
remoteMediaAssetLoaderFactory.token,
|
|
224
|
+
[remoteMediaAssetLoaderFactory.token] as const,
|
|
225
|
+
(defaultLoader: AssetLoader): AssetLoader => {
|
|
226
|
+
return async (asset, lens) => {
|
|
227
|
+
if (lens?.id === MY_SPECIAL_LENS) {
|
|
228
|
+
return (await fetch('my/asset.glb')).arrayBuffer()
|
|
229
|
+
}
|
|
230
|
+
return defaultLoader(asset, lens)
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
const myExtension = createExtension().provides(myCustomeRemoteAssetLoader)
|
|
236
|
+
const cameraKit = bootstrapCameraKit(config, container => container.provides(myExtension))
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This also enables greater modularity – the person/team creating the extension can do so in their own package, which
|
|
240
|
+
could be shared by many applications that all require the same functionality.
|
|
241
|
+
|
|
242
|
+
#### Returns
|
|
243
|
+
|
|
244
|
+
`PartialContainer`
|
|
245
|
+
|
|
246
|
+
A PartialContainer which can be used to create a collection of Services, and can later be provided
|
|
247
|
+
to CameraKit's DI container during [bootstrapCameraKit](modules.md#bootstrapcamerakit).
|
|
248
|
+
|
|
249
|
+
___
|
|
250
|
+
|
|
251
|
+
### getRequiredBootstrapURLs
|
|
252
|
+
|
|
253
|
+
▸ **getRequiredBootstrapURLs**(`endpointOverride?`): `Promise`<`string`[]\>
|
|
254
|
+
|
|
255
|
+
Returns a list of URLs for resources which will be fetched during [bootstrapCameraKit](modules.md#bootstrapcamerakit).
|
|
256
|
+
|
|
257
|
+
When CameraKit is used on a website, these URLs much be reachable in order for CameraKit to be successfully
|
|
258
|
+
bootstrapped.
|
|
259
|
+
|
|
260
|
+
#### Parameters
|
|
261
|
+
|
|
262
|
+
| Name | Type | Description |
|
|
263
|
+
| :------ | :------ | :------ |
|
|
264
|
+
| `endpointOverride?` | `string` | Optional endpoint override to load the assets from. |
|
|
265
|
+
|
|
266
|
+
#### Returns
|
|
267
|
+
|
|
268
|
+
`Promise`<`string`[]\>
|
|
269
|
+
|
|
270
|
+
An array of asset URLs.
|
|
271
|
+
|
|
272
|
+
## Lenses
|
|
273
|
+
|
|
274
|
+
### LensMetricsEvents
|
|
275
|
+
|
|
276
|
+
Ƭ **LensMetricsEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)<[`LensView`](modules.md#lensview)[``"name"``], [`LensView`](modules.md#lensview)\> \| [`TypedCustomEvent`](classes/TypedCustomEvent.md)<[`LensWait`](modules.md#lenswait)[``"name"``], [`LensWait`](modules.md#lenswait)\>
|
|
277
|
+
|
|
278
|
+
Lens metrics events.
|
|
279
|
+
|
|
280
|
+
These events are emitted by [CameraKit](classes/CameraKit.md) to report lens usage, performance, apply latency, etc.
|
|
281
|
+
|
|
282
|
+
___
|
|
283
|
+
|
|
284
|
+
### LensLaunchParams
|
|
285
|
+
|
|
286
|
+
Ƭ **LensLaunchParams**: `Record`<`string`, `string` \| `number` \| `string`[] \| `number`[]\>
|
|
287
|
+
|
|
288
|
+
Various lenses may support the passing of certain parameters from the application to the lens when it is launched.
|
|
289
|
+
|
|
290
|
+
___
|
|
291
|
+
|
|
292
|
+
### AssetTiming
|
|
293
|
+
|
|
294
|
+
Ƭ **AssetTiming**: keyof typeof `assetTimingMap`
|
|
295
|
+
|
|
296
|
+
Lens assets are included in a manifest, and each will indicate when that asset will be used by the lens.
|
|
297
|
+
|
|
298
|
+
Assets can have the following timing values:
|
|
299
|
+
- `required`: the lens will definitely request this asset immediately when the lens is applied.
|
|
300
|
+
- `onDemand`: the lens may request this asset at some time while the lens is applied.
|
|
301
|
+
|
|
302
|
+
Depending on the use-case, an application may want to cache both required and onDemand assets for
|
|
303
|
+
a particular lens, or may decide to only cache required assets (or cache no assets).
|
|
304
|
+
|
|
305
|
+
___
|
|
306
|
+
|
|
307
|
+
### AssetLoader
|
|
308
|
+
|
|
309
|
+
Ƭ **AssetLoader**: (`asset`: `AssetDescriptor`, `lens?`: [`Lens`](interfaces/Lens.md), `assetManifest?`: `LensAssetManifestItem`[]) => `Promise`<`AssetResponse`\> \| `AssetResponse`
|
|
310
|
+
|
|
311
|
+
#### Type declaration
|
|
312
|
+
|
|
313
|
+
▸ (`asset`, `lens?`, `assetManifest?`): `Promise`<`AssetResponse`\> \| `AssetResponse`
|
|
314
|
+
|
|
315
|
+
An AssetLoader is used to retrieve assets. A separate loader may be defined to retrieve different asset types.
|
|
316
|
+
|
|
317
|
+
##### Parameters
|
|
318
|
+
|
|
319
|
+
| Name | Type |
|
|
320
|
+
| :------ | :------ |
|
|
321
|
+
| `asset` | `AssetDescriptor` |
|
|
322
|
+
| `lens?` | [`Lens`](interfaces/Lens.md) |
|
|
323
|
+
| `assetManifest?` | `LensAssetManifestItem`[] |
|
|
324
|
+
|
|
325
|
+
##### Returns
|
|
326
|
+
|
|
327
|
+
`Promise`<`AssetResponse`\> \| `AssetResponse`
|
|
328
|
+
|
|
329
|
+
___
|
|
330
|
+
|
|
331
|
+
### LensView
|
|
332
|
+
|
|
333
|
+
Ƭ **LensView**: `MakeTaggedBusinessEvent`<``"lensView"``\>
|
|
334
|
+
|
|
335
|
+
The LensView metric is emitted after a lens has been viewed (for longer than 100ms), when the lens is turned off.
|
|
336
|
+
|
|
337
|
+
It contains information about rendering performance.
|
|
338
|
+
|
|
339
|
+
Notes:
|
|
340
|
+
- If the page is hidden (e.g. user switches to a different tab, or application, or closes the tab, or closes the
|
|
341
|
+
browser, navigates to a new page, refreshes, etc.) this metric will be emitted at that time. This is to ensure
|
|
342
|
+
we don't lose the metric if the page is closed.
|
|
343
|
+
- If the page is hidden and then made visible again later (e.g. user switches to a different tab, then back), we
|
|
344
|
+
will begin measuring a new LensView. That is, we will not capture the time when the page is hidden even if the
|
|
345
|
+
lens is still rendering in the background.
|
|
346
|
+
|
|
347
|
+
___
|
|
348
|
+
|
|
349
|
+
### LensWait
|
|
350
|
+
|
|
351
|
+
Ƭ **LensWait**: `MakeTaggedBusinessEvent`<``"lensWait"``\>
|
|
352
|
+
|
|
353
|
+
The LensWait metric measures the time spent downloading the lens content and required assets. It gives an indication
|
|
354
|
+
of the real UX impact of download latency. If lens content and assets are pre-loaded, the latency measured here
|
|
355
|
+
should decrease – we measure between the request to apply a lens and when the lens is ready to render.
|
|
356
|
+
|
|
357
|
+
___
|
|
358
|
+
|
|
359
|
+
### RenderTarget
|
|
360
|
+
|
|
361
|
+
Ƭ **RenderTarget**: ``"live"`` \| ``"capture"``
|
|
362
|
+
|
|
363
|
+
Enumerates the supported render targets.
|
|
364
|
+
|
|
365
|
+
Lenses may render to different render targets, as designed by the lens creator. In CameraKit, it's possible to choose
|
|
366
|
+
which render target to render, and the result for each target is available as a separate `<canvas>` element.
|
|
367
|
+
|
|
368
|
+
___
|
|
369
|
+
|
|
370
|
+
### CameraKitSessionEvents
|
|
371
|
+
|
|
372
|
+
Ƭ **CameraKitSessionEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)<``"error"``, { `error`: [`LensExecutionError`](modules.md#lensexecutionerror) \| [`LensImagePickerError`](modules.md#lensimagepickererror) ; `lens`: [`Lens`](interfaces/Lens.md) }\>
|
|
373
|
+
|
|
374
|
+
Events emitted by [CameraKitSession.events](classes/CameraKitSession.md#events).
|
|
375
|
+
|
|
376
|
+
The following events are emitted:
|
|
377
|
+
- `error`: An error has been encountered during lens rendering. May contain an error of type:
|
|
378
|
+
- [LensExecutionError](modules.md#lensexecutionerror) If an error of this type occurs, the rendering lens will be automatically removed
|
|
379
|
+
from the associated CameraKitSession.
|
|
380
|
+
- [LensImagePickerError](modules.md#lensimagepickererror)
|
|
381
|
+
|
|
382
|
+
___
|
|
383
|
+
|
|
384
|
+
### Keyboard
|
|
385
|
+
|
|
386
|
+
Ƭ **Keyboard**: `Object`
|
|
387
|
+
|
|
388
|
+
Keyboard is an API enabling lenses to consume and render user-generated text.
|
|
389
|
+
|
|
390
|
+
Applications that wish to use lenses that expect user-generated text will need to use this API to integrate text
|
|
391
|
+
input into their user experience.
|
|
392
|
+
|
|
393
|
+
There are two ways to do this:
|
|
394
|
+
1. Add the provided DOM element (an HTMLTextAreaElement) to the page. When the user updates this element with text,
|
|
395
|
+
that text will be sent to the currently active lens.
|
|
396
|
+
2. Use the sendInputToLens method to send text strings to the currently active lens directly.
|
|
397
|
+
|
|
398
|
+
Lenses will also signal to the application when text input is expected -- applications should add an event listener
|
|
399
|
+
and ensure the user is able to input text when the `active` event is received.
|
|
400
|
+
|
|
401
|
+
**`Example`**
|
|
402
|
+
|
|
403
|
+
```ts
|
|
404
|
+
cameraKitSession.keyboard.addEventListener('active', ({ detail }) => {
|
|
405
|
+
const { element, active } = detail
|
|
406
|
+
if (active) document.body.appendChild(element)
|
|
407
|
+
else element.remove()
|
|
408
|
+
})
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
#### Type declaration
|
|
412
|
+
|
|
413
|
+
| Name | Type |
|
|
414
|
+
| :------ | :------ |
|
|
415
|
+
| `addEventListener` | (`type`: ``"active"``, `callback`: `TypedEventListener`<[`KeyboardEvents`](modules.md#keyboardevents)\>, `options?`: `TypedEventListenerOptions`) => `void` |
|
|
416
|
+
| `removeEventListener` | (`type`: ``"active"``, `callback`: `TypedEventListener`<[`KeyboardEvents`](modules.md#keyboardevents)\>) => `void` |
|
|
417
|
+
| `getElement` | () => `HTMLTextAreaElement` |
|
|
418
|
+
| `sendInputToLens` | (`text`: `string`) => `void` |
|
|
419
|
+
| `dismiss` | () => `void` |
|
|
420
|
+
|
|
421
|
+
## Metrics
|
|
422
|
+
|
|
423
|
+
### LensMetricsEvents
|
|
424
|
+
|
|
425
|
+
Ƭ **LensMetricsEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)<[`LensView`](modules.md#lensview)[``"name"``], [`LensView`](modules.md#lensview)\> \| [`TypedCustomEvent`](classes/TypedCustomEvent.md)<[`LensWait`](modules.md#lenswait)[``"name"``], [`LensWait`](modules.md#lenswait)\>
|
|
426
|
+
|
|
427
|
+
Lens metrics events.
|
|
428
|
+
|
|
429
|
+
These events are emitted by [CameraKit](classes/CameraKit.md) to report lens usage, performance, apply latency, etc.
|
|
430
|
+
|
|
431
|
+
___
|
|
432
|
+
|
|
433
|
+
### LensView
|
|
434
|
+
|
|
435
|
+
Ƭ **LensView**: `MakeTaggedBusinessEvent`<``"lensView"``\>
|
|
436
|
+
|
|
437
|
+
The LensView metric is emitted after a lens has been viewed (for longer than 100ms), when the lens is turned off.
|
|
438
|
+
|
|
439
|
+
It contains information about rendering performance.
|
|
440
|
+
|
|
441
|
+
Notes:
|
|
442
|
+
- If the page is hidden (e.g. user switches to a different tab, or application, or closes the tab, or closes the
|
|
443
|
+
browser, navigates to a new page, refreshes, etc.) this metric will be emitted at that time. This is to ensure
|
|
444
|
+
we don't lose the metric if the page is closed.
|
|
445
|
+
- If the page is hidden and then made visible again later (e.g. user switches to a different tab, then back), we
|
|
446
|
+
will begin measuring a new LensView. That is, we will not capture the time when the page is hidden even if the
|
|
447
|
+
lens is still rendering in the background.
|
|
448
|
+
|
|
449
|
+
___
|
|
450
|
+
|
|
451
|
+
### LensWait
|
|
452
|
+
|
|
453
|
+
Ƭ **LensWait**: `MakeTaggedBusinessEvent`<``"lensWait"``\>
|
|
454
|
+
|
|
455
|
+
The LensWait metric measures the time spent downloading the lens content and required assets. It gives an indication
|
|
456
|
+
of the real UX impact of download latency. If lens content and assets are pre-loaded, the latency measured here
|
|
457
|
+
should decrease – we measure between the request to apply a lens and when the lens is ready to render.
|
|
458
|
+
|
|
459
|
+
## Other
|
|
460
|
+
|
|
461
|
+
### UriHandlers
|
|
462
|
+
|
|
463
|
+
Ƭ **UriHandlers**: [`UriHandler`](interfaces/UriHandler.md)[]
|
|
464
|
+
|
|
465
|
+
Array of [UriHandler](interfaces/UriHandler.md) objects.
|
|
466
|
+
|
|
467
|
+
___
|
|
468
|
+
|
|
469
|
+
### Uri
|
|
470
|
+
|
|
471
|
+
Ƭ **Uri**: \`${string}://${string}\`
|
|
472
|
+
|
|
473
|
+
___
|
|
474
|
+
|
|
475
|
+
### CameraKitSourceInfo
|
|
476
|
+
|
|
477
|
+
Ƭ **CameraKitSourceInfo**: `Pick`<`UseMediaElementInput`, ``"media"`` \| ``"replayTrackingData"`` \| ``"useManualFrameProcessing"``\>
|
|
478
|
+
|
|
479
|
+
___
|
|
480
|
+
|
|
481
|
+
### LegalError
|
|
482
|
+
|
|
483
|
+
Ƭ **LegalError**: `NamedError`<``"LegalError"``\>
|
|
484
|
+
|
|
485
|
+
___
|
|
486
|
+
|
|
487
|
+
### LensContentValidationError
|
|
488
|
+
|
|
489
|
+
Ƭ **LensContentValidationError**: `NamedError`<``"LensContentValidationError"``\>
|
|
490
|
+
|
|
491
|
+
___
|
|
492
|
+
|
|
493
|
+
### LensError
|
|
494
|
+
|
|
495
|
+
Ƭ **LensError**: `NamedError`<``"LensError"``\>
|
|
496
|
+
|
|
497
|
+
___
|
|
498
|
+
|
|
499
|
+
### CameraKitSourceError
|
|
500
|
+
|
|
501
|
+
Ƭ **CameraKitSourceError**: `NamedError`<``"CameraKitSourceError"``\>
|
|
502
|
+
|
|
503
|
+
___
|
|
504
|
+
|
|
505
|
+
### LensImagePickerError
|
|
506
|
+
|
|
507
|
+
Ƭ **LensImagePickerError**: `NamedError`<``"LensImagePickerError"``\>
|
|
508
|
+
|
|
509
|
+
The error triggered when a lens prompts the user to select an image, but the image fails to be successfully delivered
|
|
510
|
+
to the lens.
|
|
511
|
+
|
|
512
|
+
___
|
|
513
|
+
|
|
514
|
+
### CacheKeyNotFoundError
|
|
515
|
+
|
|
516
|
+
Ƭ **CacheKeyNotFoundError**: `NamedError`<``"CacheKeyNotFoundError"``\>
|
|
517
|
+
|
|
518
|
+
___
|
|
519
|
+
|
|
520
|
+
### WebGLError
|
|
521
|
+
|
|
522
|
+
Ƭ **WebGLError**: `NamedError`<``"WebGLError"``\>
|
|
523
|
+
|
|
524
|
+
___
|
|
525
|
+
|
|
526
|
+
### BenchmarkError
|
|
527
|
+
|
|
528
|
+
Ƭ **BenchmarkError**: `NamedError`<``"BenchmarkError"``\>
|
|
529
|
+
|
|
530
|
+
___
|
|
531
|
+
|
|
532
|
+
### LensExecutionError
|
|
533
|
+
|
|
534
|
+
Ƭ **LensExecutionError**: `NamedError`<``"LensExecutionError"``\>
|
|
535
|
+
|
|
536
|
+
This error occurs if a Lens is unable to continue rendering.
|
|
537
|
+
|
|
538
|
+
If this error occurs, Camera Kit automatically removes the Lens from the session.
|
|
539
|
+
It's always a good idea to handle this error and update the user experience accordingly.
|
|
540
|
+
For example, you could remove the faulty Lens from your Lens selection UI.
|
|
541
|
+
|
|
542
|
+
```ts
|
|
543
|
+
cameraKitSession.events.addEventListener('error', ({ detail }) => {
|
|
544
|
+
if (detail.error.name === 'LensExecutionError') {
|
|
545
|
+
console.log(`Lens ${detail.lens.name} encountered an error and was removed. Please pick a different lens.`)
|
|
546
|
+
}
|
|
547
|
+
})
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
___
|
|
551
|
+
|
|
552
|
+
### PersistentStoreError
|
|
553
|
+
|
|
554
|
+
Ƭ **PersistentStoreError**: `NamedError`<``"PersistentStoreError"``\>
|
|
555
|
+
|
|
556
|
+
Error thrown when LensCore asked to store lens data, but CameraKit failed storing that.
|
|
557
|
+
|
|
558
|
+
___
|
|
559
|
+
|
|
560
|
+
### LensAssetError
|
|
561
|
+
|
|
562
|
+
Ƭ **LensAssetError**: `NamedError`<``"LensAssetError"``\>
|
|
563
|
+
|
|
564
|
+
Error thrown when LensCore asked to provide an asset, but CameraKit failed providing that.
|
|
565
|
+
|
|
566
|
+
___
|
|
567
|
+
|
|
568
|
+
### CameraKitSessionEventListener
|
|
569
|
+
|
|
570
|
+
Ƭ **CameraKitSessionEventListener**: `TypedEventListener`<[`CameraKitSessionEvents`](modules.md#camerakitsessionevents)\>
|
|
571
|
+
|
|
572
|
+
Listener of [CameraKitSessionEvents](modules.md#camerakitsessionevents) events.
|
|
573
|
+
|
|
574
|
+
___
|
|
575
|
+
|
|
576
|
+
### KeyboardEvents
|
|
577
|
+
|
|
578
|
+
Ƭ **KeyboardEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)<``"active"``, { `element`: `HTMLTextAreaElement` ; `active`: `boolean` ; `lens?`: [`Lens`](interfaces/Lens.md) }\>
|
|
579
|
+
|
|
580
|
+
Events emitted by [Keyboard](modules.md#keyboard).
|
|
581
|
+
|
|
582
|
+
___
|
|
583
|
+
|
|
584
|
+
### extensionRequestContext
|
|
585
|
+
|
|
586
|
+
• `Const` **extensionRequestContext**: `ArrayBuffer`
|
|
587
|
+
|
|
588
|
+
Extension request context.
|
|
589
|
+
|
|
590
|
+
___
|
|
591
|
+
|
|
592
|
+
### Injectable
|
|
593
|
+
|
|
594
|
+
▸ **Injectable**<`Token`, `Service`\>(`token`, `fn`): `InjectableFunction`<`any`, [], `Token`, `Service`\>
|
|
595
|
+
|
|
596
|
+
Create an Injectable function with no dependencies (i.e. arguments).
|
|
597
|
+
|
|
598
|
+
Ex:
|
|
599
|
+
```ts
|
|
600
|
+
const createMyService = Factory(
|
|
601
|
+
'MyService',
|
|
602
|
+
() => { ... },
|
|
603
|
+
)
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
#### Type parameters
|
|
607
|
+
|
|
608
|
+
| Name | Type |
|
|
609
|
+
| :------ | :------ |
|
|
610
|
+
| `Token` | extends `string` |
|
|
611
|
+
| `Service` | `Service` |
|
|
612
|
+
|
|
613
|
+
#### Parameters
|
|
614
|
+
|
|
615
|
+
| Name | Type | Description |
|
|
616
|
+
| :------ | :------ | :------ |
|
|
617
|
+
| `token` | `Token` | A unique string Token which will correspond to the created Service. |
|
|
618
|
+
| `fn` | () => `Service` | A function with no arguments which returns the Service. |
|
|
619
|
+
|
|
620
|
+
#### Returns
|
|
621
|
+
|
|
622
|
+
`InjectableFunction`<`any`, [], `Token`, `Service`\>
|
|
623
|
+
|
|
624
|
+
▸ **Injectable**<`Token`, `Tokens`, `Params`, `Service`\>(`token`, `dependencies`, `fn`): `Tokens`[``"length"``] extends `Params`[``"length"``] ? `InjectableFunction`<`ServicesFromTokenizedParams`<`Tokens`, `Params`\>, `Tokens`, `Token`, `Service`\> : `never`
|
|
625
|
+
|
|
626
|
+
Create an Injectable function with dependencies (i.e. arguments).
|
|
627
|
+
|
|
628
|
+
**Note:** the list of dependencies must be readonly – that is, a literal tuple marked `as const`. This tuple must
|
|
629
|
+
contain only string literals or string consts.
|
|
630
|
+
|
|
631
|
+
Ex:
|
|
632
|
+
```ts
|
|
633
|
+
const DependencyB = 'DependencyB'
|
|
634
|
+
const createMyService = Factory(
|
|
635
|
+
'MyService',
|
|
636
|
+
['DependencyA', DependencyB] as const,
|
|
637
|
+
(a: A, b: B) => { ... },
|
|
638
|
+
)
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
#### Type parameters
|
|
642
|
+
|
|
643
|
+
| Name | Type |
|
|
644
|
+
| :------ | :------ |
|
|
645
|
+
| `Token` | extends `string` |
|
|
646
|
+
| `Tokens` | extends readonly `string`[] |
|
|
647
|
+
| `Params` | extends readonly `any`[] |
|
|
648
|
+
| `Service` | `Service` |
|
|
649
|
+
|
|
650
|
+
#### Parameters
|
|
651
|
+
|
|
652
|
+
| Name | Type | Description |
|
|
653
|
+
| :------ | :------ | :------ |
|
|
654
|
+
| `token` | `Token` | A unique string Token which will correspond to the created Service. |
|
|
655
|
+
| `dependencies` | `Tokens` | A *readonly* list of Tokens corresponding to dependencies (i.e. arguments to the Factory), which will be resolved by the Container to which this Factory is provided. |
|
|
656
|
+
| `fn` | (...`args`: `Tokens`[``"length"``] extends `Params`[``"length"``] ? `Params` : `void`[]) => `Service` | A function with arguments matching in type and length to the given list of dependencies. When called, it must return the Service. |
|
|
657
|
+
|
|
658
|
+
#### Returns
|
|
659
|
+
|
|
660
|
+
`Tokens`[``"length"``] extends `Params`[``"length"``] ? `InjectableFunction`<`ServicesFromTokenizedParams`<`Tokens`, `Params`\>, `Tokens`, `Token`, `Service`\> : `never`
|
|
661
|
+
|
|
662
|
+
___
|
|
663
|
+
|
|
664
|
+
### lensSourcesFactory
|
|
665
|
+
|
|
666
|
+
▸ **lensSourcesFactory**(`...args`): [`LensSources`](classes/LensSources.md)
|
|
667
|
+
|
|
668
|
+
#### Parameters
|
|
669
|
+
|
|
670
|
+
| Name | Type |
|
|
671
|
+
| :------ | :------ |
|
|
672
|
+
| `...args` | [] |
|
|
673
|
+
|
|
674
|
+
#### Returns
|
|
675
|
+
|
|
676
|
+
[`LensSources`](classes/LensSources.md)
|
|
677
|
+
|
|
678
|
+
___
|
|
679
|
+
|
|
680
|
+
### uriHandlersFactory
|
|
681
|
+
|
|
682
|
+
▸ **uriHandlersFactory**(`...args`): [`UriHandlers`](modules.md#urihandlers)
|
|
683
|
+
|
|
684
|
+
An extension point for client URI handlers.
|
|
685
|
+
|
|
686
|
+
#### Parameters
|
|
687
|
+
|
|
688
|
+
| Name | Type |
|
|
689
|
+
| :------ | :------ |
|
|
690
|
+
| `...args` | [] |
|
|
691
|
+
|
|
692
|
+
#### Returns
|
|
693
|
+
|
|
694
|
+
[`UriHandlers`](modules.md#urihandlers)
|
|
695
|
+
|
|
696
|
+
## Rendering
|
|
697
|
+
|
|
698
|
+
### CameraKitDeviceInfo
|
|
699
|
+
|
|
700
|
+
Ƭ **CameraKitDeviceInfo**: `Object`
|
|
701
|
+
|
|
702
|
+
#### Type declaration
|
|
703
|
+
|
|
704
|
+
| Name | Type |
|
|
705
|
+
| :------ | :------ |
|
|
706
|
+
| `cameraType` | ``"front"`` \| ``"back"`` |
|
|
707
|
+
| `fpsLimit` | `number` |
|
|
708
|
+
|
|
709
|
+
___
|
|
710
|
+
|
|
711
|
+
### CameraKitSourceOptions
|
|
712
|
+
|
|
713
|
+
Ƭ **CameraKitSourceOptions**<`T`\>: `Partial`<`T`\> & `Partial`<[`CameraKitDeviceInfo`](modules.md#camerakitdeviceinfo)\>
|
|
714
|
+
|
|
715
|
+
#### Type parameters
|
|
716
|
+
|
|
717
|
+
| Name | Type |
|
|
718
|
+
| :------ | :------ |
|
|
719
|
+
| `T` | {} |
|
|
720
|
+
|
|
721
|
+
___
|
|
722
|
+
|
|
723
|
+
### RenderTarget
|
|
724
|
+
|
|
725
|
+
Ƭ **RenderTarget**: ``"live"`` \| ``"capture"``
|
|
726
|
+
|
|
727
|
+
Enumerates the supported render targets.
|
|
728
|
+
|
|
729
|
+
Lenses may render to different render targets, as designed by the lens creator. In CameraKit, it's possible to choose
|
|
730
|
+
which render target to render, and the result for each target is available as a separate `<canvas>` element.
|
|
731
|
+
|
|
732
|
+
___
|
|
733
|
+
|
|
734
|
+
### CameraKitSessionEvents
|
|
735
|
+
|
|
736
|
+
Ƭ **CameraKitSessionEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)<``"error"``, { `error`: [`LensExecutionError`](modules.md#lensexecutionerror) \| [`LensImagePickerError`](modules.md#lensimagepickererror) ; `lens`: [`Lens`](interfaces/Lens.md) }\>
|
|
737
|
+
|
|
738
|
+
Events emitted by [CameraKitSession.events](classes/CameraKitSession.md#events).
|
|
739
|
+
|
|
740
|
+
The following events are emitted:
|
|
741
|
+
- `error`: An error has been encountered during lens rendering. May contain an error of type:
|
|
742
|
+
- [LensExecutionError](modules.md#lensexecutionerror) If an error of this type occurs, the rendering lens will be automatically removed
|
|
743
|
+
from the associated CameraKitSession.
|
|
744
|
+
- [LensImagePickerError](modules.md#lensimagepickererror)
|
|
745
|
+
|
|
746
|
+
___
|
|
747
|
+
|
|
748
|
+
### createImageSource
|
|
749
|
+
|
|
750
|
+
▸ **createImageSource**(`image`, `options?`): [`CameraKitSource`](classes/CameraKitSource.md)
|
|
751
|
+
|
|
752
|
+
Create a [CameraKitSource](classes/CameraKitSource.md) from an
|
|
753
|
+
[HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement).
|
|
754
|
+
|
|
755
|
+
#### Parameters
|
|
756
|
+
|
|
757
|
+
| Name | Type | Description |
|
|
758
|
+
| :------ | :------ | :------ |
|
|
759
|
+
| `image` | `HTMLImageElement` | Image element. |
|
|
760
|
+
| `options` | [`CameraKitSourceOptions`](modules.md#camerakitsourceoptions)<{}\> | |
|
|
761
|
+
|
|
762
|
+
#### Returns
|
|
763
|
+
|
|
764
|
+
[`CameraKitSource`](classes/CameraKitSource.md)
|
|
765
|
+
|
|
766
|
+
___
|
|
767
|
+
|
|
768
|
+
### createUserMediaSource
|
|
769
|
+
|
|
770
|
+
▸ **createUserMediaSource**(`constraints?`, `options?`): `Promise`<[`CameraKitSource`](classes/CameraKitSource.md)\>
|
|
771
|
+
|
|
772
|
+
Create a [CameraKitSource](classes/CameraKitSource.md) from a user's media device -- this calls
|
|
773
|
+
[MediaDevices.getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) to get a
|
|
774
|
+
MediaStream and then calls [createMediaStreamSource](modules.md#createmediastreamsource).
|
|
775
|
+
|
|
776
|
+
#### Parameters
|
|
777
|
+
|
|
778
|
+
| Name | Type | Description |
|
|
779
|
+
| :------ | :------ | :------ |
|
|
780
|
+
| `constraints` | `MediaStreamConstraints` | Specify contraints used to get a MediaStream from a media device. By default we simply request a video stream. |
|
|
781
|
+
| `options` | [`CameraKitSourceOptions`](modules.md#camerakitsourceoptions)<[`MediaStreamSourceOptions`](interfaces/MediaStreamSourceOptions.md)\> | |
|
|
782
|
+
|
|
783
|
+
#### Returns
|
|
784
|
+
|
|
785
|
+
`Promise`<[`CameraKitSource`](classes/CameraKitSource.md)\>
|
|
786
|
+
|
|
787
|
+
A Promise, resolving to [CameraKitSource](classes/CameraKitSource.md)
|
|
788
|
+
|
|
789
|
+
___
|
|
790
|
+
|
|
791
|
+
### createMediaStreamSource
|
|
792
|
+
|
|
793
|
+
▸ **createMediaStreamSource**(`stream`, `options?`): [`CameraKitSource`](classes/CameraKitSource.md)
|
|
794
|
+
|
|
795
|
+
Create a [CameraKitSource](classes/CameraKitSource.md) from any
|
|
796
|
+
[MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream).
|
|
797
|
+
|
|
798
|
+
#### Parameters
|
|
799
|
+
|
|
800
|
+
| Name | Type | Description |
|
|
801
|
+
| :------ | :------ | :------ |
|
|
802
|
+
| `stream` | `MediaStream` | Any MediaStream, such as obtained via `canvas.captureStream()` |
|
|
803
|
+
| `options` | [`CameraKitSourceOptions`](modules.md#camerakitsourceoptions)<[`MediaStreamSourceOptions`](interfaces/MediaStreamSourceOptions.md)\> | |
|
|
804
|
+
|
|
805
|
+
#### Returns
|
|
806
|
+
|
|
807
|
+
[`CameraKitSource`](classes/CameraKitSource.md)
|
|
808
|
+
|
|
809
|
+
___
|
|
810
|
+
|
|
811
|
+
### createVideoSource
|
|
812
|
+
|
|
813
|
+
▸ **createVideoSource**(`video`, `options?`): [`CameraKitSource`](classes/CameraKitSource.md)
|
|
814
|
+
|
|
815
|
+
Create a [CameraKitSource](classes/CameraKitSource.md) from an
|
|
816
|
+
[HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).
|
|
817
|
+
|
|
818
|
+
#### Parameters
|
|
819
|
+
|
|
820
|
+
| Name | Type | Description |
|
|
821
|
+
| :------ | :------ | :------ |
|
|
822
|
+
| `video` | `HTMLVideoElement` | CameraKit performs best when the source video is 720p – arbitrary resolutions are supported, but very high resolutions may not perform well. |
|
|
823
|
+
| `options` | [`CameraKitSourceOptions`](modules.md#camerakitsourceoptions)<[`VideoSourceOptions`](interfaces/VideoSourceOptions.md)\> | |
|
|
824
|
+
|
|
825
|
+
#### Returns
|
|
826
|
+
|
|
827
|
+
[`CameraKitSource`](classes/CameraKitSource.md)
|