@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.
Files changed (302) hide show
  1. package/README.md +1 -1
  2. package/dist/CameraKit.d.ts +17 -6
  3. package/dist/CameraKit.d.ts.map +1 -1
  4. package/dist/CameraKit.js +26 -4
  5. package/dist/CameraKit.js.map +1 -1
  6. package/dist/RootServices.d.ts +6 -2
  7. package/dist/RootServices.d.ts.map +1 -1
  8. package/dist/RootServices.js.map +1 -1
  9. package/dist/bootstrapCameraKit.d.ts.map +1 -1
  10. package/dist/bootstrapCameraKit.js +6 -2
  11. package/dist/bootstrapCameraKit.js.map +1 -1
  12. package/dist/clients/remoteApiSpecsClient.d.ts +10 -0
  13. package/dist/clients/remoteApiSpecsClient.d.ts.map +1 -0
  14. package/dist/clients/remoteApiSpecsClient.js +6 -0
  15. package/dist/clients/remoteApiSpecsClient.js.map +1 -0
  16. package/dist/common/typeguards.d.ts +3 -0
  17. package/dist/common/typeguards.d.ts.map +1 -1
  18. package/dist/common/typeguards.js +12 -0
  19. package/dist/common/typeguards.js.map +1 -1
  20. package/dist/configuration.d.ts +115 -0
  21. package/dist/configuration.d.ts.map +1 -1
  22. package/dist/configuration.js +1 -0
  23. package/dist/configuration.js.map +1 -1
  24. package/dist/environment.js +1 -1
  25. package/dist/environment.js.map +1 -1
  26. package/dist/extensions/extensionRequestContext.d.ts +6 -0
  27. package/dist/extensions/extensionRequestContext.d.ts.map +1 -1
  28. package/dist/extensions/extensionRequestContext.js +3 -2
  29. package/dist/extensions/extensionRequestContext.js.map +1 -1
  30. package/dist/geo/geoDataProvider.d.ts +32 -0
  31. package/dist/geo/geoDataProvider.d.ts.map +1 -0
  32. package/dist/geo/geoDataProvider.js +25 -0
  33. package/dist/geo/geoDataProvider.js.map +1 -0
  34. package/dist/geo/registerGeoDataProvider.d.ts +11 -0
  35. package/dist/geo/registerGeoDataProvider.d.ts.map +1 -0
  36. package/dist/geo/registerGeoDataProvider.js +22 -0
  37. package/dist/geo/registerGeoDataProvider.js.map +1 -0
  38. package/dist/index.d.ts +6 -5
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +5 -4
  41. package/dist/index.js.map +1 -1
  42. package/dist/lens-core-module/generated-types.d.ts +28 -0
  43. package/dist/lens-core-module/generated-types.d.ts.map +1 -1
  44. package/dist/lens-core-module/generated-types.js.map +1 -1
  45. package/dist/lens-core-module/lensCore.d.ts.map +1 -1
  46. package/dist/lens-core-module/lensCore.js +1 -0
  47. package/dist/lens-core-module/lensCore.js.map +1 -1
  48. package/dist/lensCoreWasmVersions.js +3 -3
  49. package/dist/lensCoreWasmVersions.js.map +1 -1
  50. package/dist/platform/platformInfo.d.ts.map +1 -1
  51. package/dist/platform/platformInfo.js +1 -1
  52. package/dist/platform/platformInfo.js.map +1 -1
  53. package/dist/remote-configuration/cofHandler.js.map +1 -1
  54. package/dist/remote-configuration/remoteConfiguration.d.ts +4 -0
  55. package/dist/remote-configuration/remoteConfiguration.d.ts.map +1 -1
  56. package/dist/remote-configuration/remoteConfiguration.js +10 -0
  57. package/dist/remote-configuration/remoteConfiguration.js.map +1 -1
  58. package/dist/session/CameraKitSession.d.ts +9 -9
  59. package/dist/session/CameraKitSession.d.ts.map +1 -1
  60. package/dist/session/CameraKitSession.js +4 -2
  61. package/dist/session/CameraKitSession.js.map +1 -1
  62. package/dist/session/LensKeyboard.d.ts +75 -31
  63. package/dist/session/LensKeyboard.d.ts.map +1 -1
  64. package/dist/session/LensKeyboard.js +60 -38
  65. package/dist/session/LensKeyboard.js.map +1 -1
  66. package/dist/uri-handlers/UriHandlers.d.ts.map +1 -0
  67. package/dist/uri-handlers/UriHandlers.js.map +1 -0
  68. package/dist/uri-handlers/internal-handlers/httpUriHandler.d.ts +42 -0
  69. package/dist/uri-handlers/internal-handlers/httpUriHandler.d.ts.map +1 -0
  70. package/dist/uri-handlers/internal-handlers/httpUriHandler.js +149 -0
  71. package/dist/uri-handlers/internal-handlers/httpUriHandler.js.map +1 -0
  72. package/dist/uri-handlers/internal-handlers/httpValidators.d.ts +9 -0
  73. package/dist/uri-handlers/internal-handlers/httpValidators.d.ts.map +1 -0
  74. package/dist/uri-handlers/internal-handlers/httpValidators.js +115 -0
  75. package/dist/uri-handlers/internal-handlers/httpValidators.js.map +1 -0
  76. package/dist/{extensions/RemoteApiServices.d.ts → uri-handlers/internal-handlers/remoteApiUriHandler.d.ts} +8 -8
  77. package/dist/uri-handlers/internal-handlers/remoteApiUriHandler.d.ts.map +1 -0
  78. package/dist/uri-handlers/internal-handlers/remoteApiUriHandler.js +121 -0
  79. package/dist/uri-handlers/internal-handlers/remoteApiUriHandler.js.map +1 -0
  80. package/dist/{extensions → uri-handlers}/uriHandlersRegister.d.ts +6 -4
  81. package/dist/uri-handlers/uriHandlersRegister.d.ts.map +1 -0
  82. package/dist/{extensions → uri-handlers}/uriHandlersRegister.js +13 -3
  83. package/dist/uri-handlers/uriHandlersRegister.js.map +1 -0
  84. package/dist/uri-handlers/uriRequestProcessor.d.ts +37 -0
  85. package/dist/uri-handlers/uriRequestProcessor.d.ts.map +1 -0
  86. package/dist/uri-handlers/uriRequestProcessor.js +69 -0
  87. package/dist/uri-handlers/uriRequestProcessor.js.map +1 -0
  88. package/docs/html/assets/hierarchy.js +1 -0
  89. package/docs/html/assets/highlight.css +9 -2
  90. package/docs/html/assets/icons.js +18 -0
  91. package/docs/html/assets/icons.svg +1 -0
  92. package/docs/html/assets/main.js +5 -4
  93. package/docs/html/assets/navigation.js +1 -1
  94. package/docs/html/assets/search.js +1 -1
  95. package/docs/html/assets/style.css +1422 -1226
  96. package/docs/html/classes/CameraKit.html +18 -16
  97. package/docs/html/classes/CameraKitSession.html +79 -51
  98. package/docs/html/classes/CameraKitSource.html +18 -18
  99. package/docs/html/classes/LensPerformanceMeasurement.html +11 -11
  100. package/docs/html/classes/LensPerformanceMetrics.html +8 -7
  101. package/docs/html/classes/LensRepository.html +25 -23
  102. package/docs/html/classes/Transform2D.html +9 -9
  103. package/docs/html/classes/TypedCustomEvent.html +5 -4
  104. package/docs/html/classes/TypedEventTarget.html +6 -6
  105. package/docs/html/enums/Lens_CameraFacing.html +5 -5
  106. package/docs/html/functions/bootstrapCameraKit.html +11 -10
  107. package/docs/html/functions/createExtension.html +7 -6
  108. package/docs/html/functions/createImageSource.html +5 -5
  109. package/docs/html/functions/createMediaStreamSource.html +5 -5
  110. package/docs/html/functions/createVideoSource.html +5 -5
  111. package/docs/html/functions/estimateLensPerformance.html +2 -2
  112. package/docs/html/functions/filePickerFactory.html +2 -2
  113. package/docs/html/functions/getExtensionRequestContext.html +3 -0
  114. package/docs/html/functions/lensSourcesFactory.html +5 -4
  115. package/docs/html/functions/remoteApiServicesFactory.html +1 -1
  116. package/docs/html/hierarchy.html +1 -1
  117. package/docs/html/index.html +111 -88
  118. package/docs/html/interfaces/BitmojiUserInfo.html +3 -3
  119. package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +40 -21
  120. package/docs/html/interfaces/CameraKitDeviceOptions.html +7 -7
  121. package/docs/html/interfaces/CameraKitSourceInfo.html +7 -7
  122. package/docs/html/interfaces/CameraKitSourceSubscriber.html +4 -4
  123. package/docs/html/interfaces/ComputedFrameMetrics.html +6 -6
  124. package/docs/html/interfaces/CreateSessionOptions.html +7 -7
  125. package/docs/html/interfaces/EstimatedLensPerformance.html +5 -5
  126. package/docs/html/interfaces/Font.html +6 -0
  127. package/docs/html/interfaces/FriendUserInfo.html +4 -4
  128. package/docs/html/interfaces/FunctionSourceOptions.html +4 -4
  129. package/docs/html/interfaces/Keyboard.html +29 -0
  130. package/docs/html/interfaces/KeyboardActiveEvent.html +12 -0
  131. package/docs/html/interfaces/Lens.html +21 -21
  132. package/docs/html/interfaces/LensCreator.html +3 -3
  133. package/docs/html/interfaces/LensHttpRequest.html +16 -0
  134. package/docs/html/interfaces/LensLaunchData.html +6 -6
  135. package/docs/html/interfaces/LensSource.html +5 -5
  136. package/docs/html/interfaces/LensUserData.html +10 -10
  137. package/docs/html/interfaces/LoadAssetRequest.html +10 -10
  138. package/docs/html/interfaces/MediaStreamSourceOptions.html +11 -11
  139. package/docs/html/interfaces/Preview.html +4 -4
  140. package/docs/html/interfaces/RemoteApiRequest.html +10 -10
  141. package/docs/html/interfaces/RemoteApiResponse.html +8 -8
  142. package/docs/html/interfaces/RemoteApiService.html +9 -9
  143. package/docs/html/interfaces/Snapcode.html +6 -6
  144. package/docs/html/interfaces/UriCancelRequest.html +3 -3
  145. package/docs/html/interfaces/UriRequest.html +7 -7
  146. package/docs/html/interfaces/UriResponse.html +6 -6
  147. package/docs/html/interfaces/VideoSourceOptions.html +9 -9
  148. package/docs/html/modules.html +1 -99
  149. package/docs/html/types/ArgumentValidationError.html +2 -2
  150. package/docs/html/types/AssetLoader.html +4 -4
  151. package/docs/html/types/AssetResponse.html +1 -1
  152. package/docs/html/types/AssetTiming.html +2 -2
  153. package/docs/html/types/BenchmarkError.html +1 -1
  154. package/docs/html/types/BootstrapError.html +2 -2
  155. package/docs/html/types/CacheKeyNotFoundError.html +1 -1
  156. package/docs/html/types/CameraKitSessionEventListener.html +2 -2
  157. package/docs/html/types/CameraKitSessionEvents.html +4 -3
  158. package/docs/html/types/CameraKitSourceError.html +1 -1
  159. package/docs/html/types/ConfigurationError.html +2 -2
  160. package/docs/html/types/FetchHandler.html +1 -1
  161. package/docs/html/types/FilePicker.html +5 -5
  162. package/docs/html/types/FilePickerOptions.html +2 -2
  163. package/docs/html/types/FilePickerResult.html +2 -2
  164. package/docs/html/types/KeyboardEventListener.html +2 -0
  165. package/docs/html/types/KeyboardEvents.html +2 -2
  166. package/docs/html/types/LegalError.html +1 -1
  167. package/docs/html/types/LensAbortError.html +6 -5
  168. package/docs/html/types/LensAssetError.html +2 -2
  169. package/docs/html/types/LensContentValidationError.html +1 -1
  170. package/docs/html/types/LensError.html +1 -1
  171. package/docs/html/types/LensExecutionError.html +6 -5
  172. package/docs/html/types/LensHttpHandler.html +9 -0
  173. package/docs/html/types/LensImagePickerError.html +2 -2
  174. package/docs/html/types/LensLaunchParams.html +2 -2
  175. package/docs/html/types/LensMetricsEvents.html +2 -2
  176. package/docs/html/types/LensPerformanceCluster.html +1 -1
  177. package/docs/html/types/LensView.html +3 -3
  178. package/docs/html/types/LensWait.html +2 -2
  179. package/docs/html/types/Matrix.html +2 -2
  180. package/docs/html/types/PersistentStoreError.html +2 -2
  181. package/docs/html/types/PlatformNotSupportedError.html +3 -3
  182. package/docs/html/types/PublicContainer.html +2 -2
  183. package/docs/html/types/PublicServices.html +2 -2
  184. package/docs/html/types/RemoteApiCancelRequestHandler.html +2 -2
  185. package/docs/html/types/RemoteApiRequestHandler.html +2 -2
  186. package/docs/html/types/RemoteApiServices.html +1 -1
  187. package/docs/html/types/RemoteApiStatus.html +2 -2
  188. package/docs/html/types/RenderTarget.html +3 -3
  189. package/docs/html/types/Uri.html +1 -1
  190. package/docs/html/types/WebGLError.html +1 -1
  191. package/docs/html/types/Zodiac.html +1 -1
  192. package/docs/html/variables/extensionRequestContext.html +3 -2
  193. package/docs/md/README.md +5 -3
  194. package/docs/md/classes/CameraKit.md +26 -37
  195. package/docs/md/classes/CameraKitSession.md +150 -108
  196. package/docs/md/classes/CameraKitSource.md +46 -37
  197. package/docs/md/classes/LensPerformanceMeasurement.md +18 -26
  198. package/docs/md/classes/LensPerformanceMetrics.md +8 -10
  199. package/docs/md/classes/LensRepository.md +66 -45
  200. package/docs/md/classes/Transform2D.md +19 -26
  201. package/docs/md/classes/TypedCustomEvent.md +24 -32
  202. package/docs/md/classes/TypedEventTarget.md +43 -54
  203. package/docs/md/enumerations/Lens_CameraFacing.md +31 -0
  204. package/docs/md/functions/bootstrapCameraKit.md +66 -0
  205. package/docs/md/functions/createExtension.md +50 -0
  206. package/docs/md/functions/createImageSource.md +30 -0
  207. package/docs/md/functions/createMediaStreamSource.md +30 -0
  208. package/docs/md/functions/createVideoSource.md +31 -0
  209. package/docs/md/functions/estimateLensPerformance.md +18 -0
  210. package/docs/md/functions/filePickerFactory.md +22 -0
  211. package/docs/md/functions/getExtensionRequestContext.md +21 -0
  212. package/docs/md/functions/lensSourcesFactory.md +37 -0
  213. package/docs/md/functions/remoteApiServicesFactory.md +19 -0
  214. package/docs/md/globals.md +124 -0
  215. package/docs/md/interfaces/BitmojiUserInfo.md +9 -12
  216. package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +99 -40
  217. package/docs/md/interfaces/CameraKitDeviceOptions.md +11 -17
  218. package/docs/md/interfaces/CameraKitSourceInfo.md +14 -20
  219. package/docs/md/interfaces/CameraKitSourceSubscriber.md +23 -28
  220. package/docs/md/interfaces/ComputedFrameMetrics.md +13 -19
  221. package/docs/md/interfaces/CreateSessionOptions.md +10 -13
  222. package/docs/md/interfaces/EstimatedLensPerformance.md +10 -14
  223. package/docs/md/interfaces/Font.md +25 -0
  224. package/docs/md/interfaces/FriendUserInfo.md +12 -16
  225. package/docs/md/interfaces/FunctionSourceOptions.md +6 -8
  226. package/docs/md/interfaces/Keyboard.md +137 -0
  227. package/docs/md/interfaces/KeyboardActiveEvent.md +46 -0
  228. package/docs/md/interfaces/Lens.md +26 -37
  229. package/docs/md/interfaces/LensCreator.md +6 -8
  230. package/docs/md/interfaces/LensHttpRequest.md +60 -0
  231. package/docs/md/interfaces/LensLaunchData.md +13 -17
  232. package/docs/md/interfaces/LensSource.md +26 -27
  233. package/docs/md/interfaces/LensUserData.md +30 -40
  234. package/docs/md/interfaces/LoadAssetRequest.md +13 -18
  235. package/docs/md/interfaces/MediaStreamSourceOptions.md +15 -22
  236. package/docs/md/interfaces/Preview.md +6 -8
  237. package/docs/md/interfaces/RemoteApiRequest.md +12 -17
  238. package/docs/md/interfaces/RemoteApiResponse.md +10 -14
  239. package/docs/md/interfaces/RemoteApiService.md +20 -19
  240. package/docs/md/interfaces/Snapcode.md +8 -11
  241. package/docs/md/interfaces/UriCancelRequest.md +7 -10
  242. package/docs/md/interfaces/UriRequest.md +15 -22
  243. package/docs/md/interfaces/UriResponse.md +14 -20
  244. package/docs/md/interfaces/VideoSourceOptions.md +13 -19
  245. package/docs/md/type-aliases/ArgumentValidationError.md +11 -0
  246. package/docs/md/type-aliases/AssetLoader.md +26 -0
  247. package/docs/md/type-aliases/AssetResponse.md +9 -0
  248. package/docs/md/type-aliases/AssetTiming.md +18 -0
  249. package/docs/md/type-aliases/BenchmarkError.md +9 -0
  250. package/docs/md/type-aliases/BootstrapError.md +12 -0
  251. package/docs/md/type-aliases/CacheKeyNotFoundError.md +9 -0
  252. package/docs/md/type-aliases/CameraKitSessionEventListener.md +11 -0
  253. package/docs/md/type-aliases/CameraKitSessionEvents.md +17 -0
  254. package/docs/md/type-aliases/CameraKitSourceError.md +9 -0
  255. package/docs/md/type-aliases/ConfigurationError.md +11 -0
  256. package/docs/md/type-aliases/FetchHandler.md +27 -0
  257. package/docs/md/type-aliases/FilePicker.md +32 -0
  258. package/docs/md/type-aliases/FilePickerOptions.md +11 -0
  259. package/docs/md/type-aliases/FilePickerResult.md +11 -0
  260. package/docs/md/type-aliases/KeyboardEventListener.md +11 -0
  261. package/docs/md/type-aliases/KeyboardEvents.md +11 -0
  262. package/docs/md/type-aliases/LegalError.md +9 -0
  263. package/docs/md/type-aliases/LensAbortError.md +22 -0
  264. package/docs/md/type-aliases/LensAssetError.md +11 -0
  265. package/docs/md/type-aliases/LensContentValidationError.md +9 -0
  266. package/docs/md/type-aliases/LensError.md +9 -0
  267. package/docs/md/type-aliases/LensExecutionError.md +23 -0
  268. package/docs/md/type-aliases/LensHttpHandler.md +41 -0
  269. package/docs/md/type-aliases/LensImagePickerError.md +12 -0
  270. package/docs/md/type-aliases/LensLaunchParams.md +11 -0
  271. package/docs/md/type-aliases/LensMetricsEvents.md +13 -0
  272. package/docs/md/type-aliases/LensPerformanceCluster.md +9 -0
  273. package/docs/md/type-aliases/LensView.md +21 -0
  274. package/docs/md/type-aliases/LensWait.md +13 -0
  275. package/docs/md/type-aliases/Matrix.md +12 -0
  276. package/docs/md/type-aliases/PersistentStoreError.md +11 -0
  277. package/docs/md/type-aliases/PlatformNotSupportedError.md +13 -0
  278. package/docs/md/type-aliases/PublicContainer.md +12 -0
  279. package/docs/md/type-aliases/PublicServices.md +11 -0
  280. package/docs/md/type-aliases/RemoteApiCancelRequestHandler.md +15 -0
  281. package/docs/md/type-aliases/RemoteApiRequestHandler.md +24 -0
  282. package/docs/md/type-aliases/RemoteApiServices.md +9 -0
  283. package/docs/md/type-aliases/RemoteApiStatus.md +11 -0
  284. package/docs/md/type-aliases/RenderTarget.md +14 -0
  285. package/docs/md/type-aliases/Uri.md +9 -0
  286. package/docs/md/type-aliases/WebGLError.md +9 -0
  287. package/docs/md/type-aliases/Zodiac.md +9 -0
  288. package/docs/md/variables/extensionRequestContext.md +15 -0
  289. package/package.json +5 -5
  290. package/dist/extensions/RemoteApiServices.d.ts.map +0 -1
  291. package/dist/extensions/RemoteApiServices.js +0 -159
  292. package/dist/extensions/RemoteApiServices.js.map +0 -1
  293. package/dist/extensions/UriHandlers.d.ts.map +0 -1
  294. package/dist/extensions/UriHandlers.js.map +0 -1
  295. package/dist/extensions/uriHandlersRegister.d.ts.map +0 -1
  296. package/dist/extensions/uriHandlersRegister.js.map +0 -1
  297. package/docs/html/types/Keyboard.html +0 -26
  298. package/docs/md/.nojekyll +0 -1
  299. package/docs/md/enums/Lens_CameraFacing.md +0 -36
  300. package/docs/md/modules.md +0 -904
  301. /package/dist/{extensions → uri-handlers}/UriHandlers.d.ts +0 -0
  302. /package/dist/{extensions → uri-handlers}/UriHandlers.js +0 -0
@@ -1,904 +0,0 @@
1
- [CameraKit Web SDK - v1.0.1](README.md) / Exports
2
-
3
- # CameraKit Web SDK - v1.0.1
4
-
5
- ## Table of contents
6
-
7
- ### Enumerations
8
-
9
- - [Lens\_CameraFacing](enums/Lens_CameraFacing.md)
10
-
11
- ### Classes
12
-
13
- - [CameraKit](classes/CameraKit.md)
14
- - [TypedCustomEvent](classes/TypedCustomEvent.md)
15
- - [TypedEventTarget](classes/TypedEventTarget.md)
16
- - [LensRepository](classes/LensRepository.md)
17
- - [CameraKitSource](classes/CameraKitSource.md)
18
- - [CameraKitSession](classes/CameraKitSession.md)
19
- - [LensPerformanceMeasurement](classes/LensPerformanceMeasurement.md)
20
- - [LensPerformanceMetrics](classes/LensPerformanceMetrics.md)
21
- - [Transform2D](classes/Transform2D.md)
22
-
23
- ### Interfaces
24
-
25
- - [CreateSessionOptions](interfaces/CreateSessionOptions.md)
26
- - [EstimatedLensPerformance](interfaces/EstimatedLensPerformance.md)
27
- - [CameraKitBootstrapConfiguration](interfaces/CameraKitBootstrapConfiguration.md)
28
- - [RemoteApiRequest](interfaces/RemoteApiRequest.md)
29
- - [RemoteApiResponse](interfaces/RemoteApiResponse.md)
30
- - [RemoteApiService](interfaces/RemoteApiService.md)
31
- - [UriRequest](interfaces/UriRequest.md)
32
- - [UriResponse](interfaces/UriResponse.md)
33
- - [UriCancelRequest](interfaces/UriCancelRequest.md)
34
- - [LensCreator](interfaces/LensCreator.md)
35
- - [Lens](interfaces/Lens.md)
36
- - [Preview](interfaces/Preview.md)
37
- - [Snapcode](interfaces/Snapcode.md)
38
- - [LensLaunchData](interfaces/LensLaunchData.md)
39
- - [LensUserData](interfaces/LensUserData.md)
40
- - [BitmojiUserInfo](interfaces/BitmojiUserInfo.md)
41
- - [FriendUserInfo](interfaces/FriendUserInfo.md)
42
- - [LensSource](interfaces/LensSource.md)
43
- - [LoadAssetRequest](interfaces/LoadAssetRequest.md)
44
- - [CameraKitSourceSubscriber](interfaces/CameraKitSourceSubscriber.md)
45
- - [CameraKitDeviceOptions](interfaces/CameraKitDeviceOptions.md)
46
- - [CameraKitSourceInfo](interfaces/CameraKitSourceInfo.md)
47
- - [FunctionSourceOptions](interfaces/FunctionSourceOptions.md)
48
- - [MediaStreamSourceOptions](interfaces/MediaStreamSourceOptions.md)
49
- - [VideoSourceOptions](interfaces/VideoSourceOptions.md)
50
- - [ComputedFrameMetrics](interfaces/ComputedFrameMetrics.md)
51
-
52
- ### Type Aliases
53
-
54
- - [LensMetricsEvents](modules.md#lensmetricsevents)
55
- - [PublicServices](modules.md#publicservices)
56
- - [LensPerformanceCluster](modules.md#lensperformancecluster)
57
- - [PublicContainer](modules.md#publiccontainer)
58
- - [RemoteApiStatus](modules.md#remoteapistatus)
59
- - [RemoteApiCancelRequestHandler](modules.md#remoteapicancelrequesthandler)
60
- - [RemoteApiRequestHandler](modules.md#remoteapirequesthandler)
61
- - [RemoteApiServices](modules.md#remoteapiservices)
62
- - [FetchHandler](modules.md#fetchhandler)
63
- - [FilePickerOptions](modules.md#filepickeroptions)
64
- - [FilePickerResult](modules.md#filepickerresult)
65
- - [FilePicker](modules.md#filepicker)
66
- - [Uri](modules.md#uri)
67
- - [LensLaunchParams](modules.md#lenslaunchparams)
68
- - [Zodiac](modules.md#zodiac)
69
- - [AssetTiming](modules.md#assettiming)
70
- - [AssetResponse](modules.md#assetresponse)
71
- - [AssetLoader](modules.md#assetloader)
72
- - [LensView](modules.md#lensview)
73
- - [LensWait](modules.md#lenswait)
74
- - [LegalError](modules.md#legalerror)
75
- - [LensContentValidationError](modules.md#lenscontentvalidationerror)
76
- - [LensError](modules.md#lenserror)
77
- - [CameraKitSourceError](modules.md#camerakitsourceerror)
78
- - [LensImagePickerError](modules.md#lensimagepickererror)
79
- - [CacheKeyNotFoundError](modules.md#cachekeynotfounderror)
80
- - [ConfigurationError](modules.md#configurationerror)
81
- - [WebGLError](modules.md#webglerror)
82
- - [BenchmarkError](modules.md#benchmarkerror)
83
- - [PlatformNotSupportedError](modules.md#platformnotsupportederror)
84
- - [LensExecutionError](modules.md#lensexecutionerror)
85
- - [LensAbortError](modules.md#lensaborterror)
86
- - [PersistentStoreError](modules.md#persistentstoreerror)
87
- - [LensAssetError](modules.md#lensasseterror)
88
- - [BootstrapError](modules.md#bootstraperror)
89
- - [ArgumentValidationError](modules.md#argumentvalidationerror)
90
- - [RenderTarget](modules.md#rendertarget)
91
- - [CameraKitSessionEvents](modules.md#camerakitsessionevents)
92
- - [CameraKitSessionEventListener](modules.md#camerakitsessioneventlistener)
93
- - [KeyboardEvents](modules.md#keyboardevents)
94
- - [Keyboard](modules.md#keyboard)
95
- - [Matrix](modules.md#matrix)
96
-
97
- ### Variables
98
-
99
- - [extensionRequestContext](modules.md#extensionrequestcontext)
100
-
101
- ### Functions
102
-
103
- - [estimateLensPerformance](modules.md#estimatelensperformance)
104
- - [bootstrapCameraKit](modules.md#bootstrapcamerakit)
105
- - [createExtension](modules.md#createextension)
106
- - [remoteApiServicesFactory](modules.md#remoteapiservicesfactory)
107
- - [filePickerFactory](modules.md#filepickerfactory)
108
- - [lensSourcesFactory](modules.md#lenssourcesfactory)
109
- - [createImageSource](modules.md#createimagesource)
110
- - [createMediaStreamSource](modules.md#createmediastreamsource)
111
- - [createVideoSource](modules.md#createvideosource)
112
-
113
- ## Bootstrapping and Configuration
114
-
115
- ### LensPerformanceCluster
116
-
117
- Ƭ **LensPerformanceCluster**: ``0`` \| ``1`` \| ``2`` \| ``3`` \| ``4`` \| ``5`` \| ``6``
118
-
119
- ___
120
-
121
- ### PublicContainer
122
-
123
- Ƭ **PublicContainer**: `Container`\<[`PublicServices`](modules.md#publicservices)\>
124
-
125
- For more advanced use-cases, this DI Container holds services for which a custom implementation may be provided by
126
- the application.
127
-
128
- ___
129
-
130
- ### ConfigurationError
131
-
132
- Ƭ **ConfigurationError**: `NamedError`\<``"ConfigurationError"``\>
133
-
134
- Thrown by [bootstrapCameraKit](modules.md#bootstrapcamerakit) if provided configuration is invalid.
135
-
136
- ___
137
-
138
- ### PlatformNotSupportedError
139
-
140
- Ƭ **PlatformNotSupportedError**: `NamedError`\<``"PlatformNotSupportedError"``\>
141
-
142
- Thrown by [bootstrapCameraKit](modules.md#bootstrapcamerakit) when the current platform is not supported by CameraKit.
143
-
144
- This can happen if the browser doesn't support a required feature (e.g. WebGL).
145
-
146
- ___
147
-
148
- ### BootstrapError
149
-
150
- Ƭ **BootstrapError**: `NamedError`\<``"BootstrapError"``\>
151
-
152
- Thrown by [bootstrapCameraKit](modules.md#bootstrapcamerakit) if an error occurs during SDK initialization or while downloading the render
153
- engine WebAssembly.
154
-
155
- ___
156
-
157
- ### estimateLensPerformance
158
-
159
- ▸ **estimateLensPerformance**(): `Promise`\<[`EstimatedLensPerformance`](interfaces/EstimatedLensPerformance.md)\>
160
-
161
- Run benchmarks which attempt to predict expected lens performance, and assign a cluster (i.e. a performance rating)
162
- which the CameraKit SDK can use to optimize certain lenses.
163
-
164
- #### Returns
165
-
166
- `Promise`\<[`EstimatedLensPerformance`](interfaces/EstimatedLensPerformance.md)\>
167
-
168
- A rating from 1-6, indicating expected Lens performance.
169
-
170
- ___
171
-
172
- ### bootstrapCameraKit
173
-
174
- ▸ **bootstrapCameraKit**(`configuration`, `provide?`): `Promise`\<[`CameraKit`](classes/CameraKit.md)\>
175
-
176
- Bootstrap CameraKit. This will download the WebAssembly code which powers CameraKit's rendering engine, and return
177
- an instance of [CameraKit](classes/CameraKit.md).
178
-
179
- CameraKit must be provided with some configuration (the application's API token), and there are some additional
180
- configurations which are optional.
181
-
182
- Descriptions of the available configurations can be found in the documentation for
183
- [CameraKitBootstrapConfiguration](interfaces/CameraKitBootstrapConfiguration.md)
184
-
185
- ---
186
-
187
- There is also a second, more advanced way to modify CameraKit to provide greater flexibility to support less common
188
- use cases.
189
-
190
- This requires some knowledge of CameraKit's dependency injection system, and allows applications to provide their
191
- own custom implementations of certain CameraKit components. This functionality will only be needed by applications
192
- with very specific, more advanced requirements.
193
-
194
- #### Parameters
195
-
196
- | Name | Type | Description |
197
- | :------ | :------ | :------ |
198
- | `configuration` | [`CameraKitBootstrapConfiguration`](interfaces/CameraKitBootstrapConfiguration.md) | Configure CameraKit with e.g. credentials, global resource endpoints, etc. |
199
- | `provide?` | (`c`: [`PublicContainer`](modules.md#publiccontainer)) => [`PublicContainer`](modules.md#publiccontainer) | Optional function that can make modifications to CameraKit's root DI container. |
200
-
201
- #### Returns
202
-
203
- `Promise`\<[`CameraKit`](classes/CameraKit.md)\>
204
-
205
- A [CameraKit](classes/CameraKit.md) instance, which is the entry point to CameraKit's API.
206
-
207
- **`Example`**
208
-
209
- ```ts
210
- // The most common way to bootstrap:
211
- const cameraKit = await bootstrapCameraKit({ apiToken: myApiToken })
212
-
213
- // For special advanced use-cases, it is possible to provide custom implementations for certain CameraKit components.
214
- const cameraKit = await bootstrapCameraKit(config, (container) => {
215
- return container.provides(myCustomRemoteMediaAssetLoaderFactory)
216
- })
217
- ```
218
-
219
- **`Throws`**
220
-
221
- - [ConfigurationError](modules.md#configurationerror) when provided configuration object is invalid
222
- - [PlatformNotSupportedError](modules.md#platformnotsupportederror) when current platform is not supported by CameraKit
223
- - [BootstrapError](modules.md#bootstraperror) when a failure occurs while initializing CameraKit and downloading the render engine
224
- WebAssembly binary.
225
-
226
- ___
227
-
228
- ### createExtension
229
-
230
- ▸ **createExtension**(): `PartialContainer`
231
-
232
- Extensions offer a way to provide custom implementations of certain parts of the CameraKit SDK.
233
-
234
- This enables more advanced use-cases, in which the default behavior of the SDK is substantially altered. For example,
235
- replacing the default implementation that loads remote lens assets with a custom implementation that returns
236
- different assets based on some business logic within the application.
237
-
238
- An extension is implemented as a PartialContainer – a collection of factory functions, each with its own
239
- dependencies, which each provide some "Service". A Service can be of any type, and the CameraKit SDK defines its
240
- own Services, some of which can be overridden by providing a custom implementation of the type via an extension.
241
-
242
- Here's an example of how extensions might be used:
243
- ```ts
244
- import { bootstrapCameraKit, createExtension, remoteMediaAssetLoaderFactory } from '@snap/camera-kit'
245
-
246
- const myCustomRemoteAssetLoader = Injectable(
247
- remoteMediaAssetLoaderFactory.token,
248
- [remoteMediaAssetLoaderFactory.token] as const,
249
- (defaultLoader: AssetLoader): AssetLoader => {
250
- return async (asset, lens) => {
251
- if (lens?.id === MY_SPECIAL_LENS) {
252
- return (await fetch('my/asset.glb')).arrayBuffer()
253
- }
254
- return defaultLoader(asset, lens)
255
- }
256
- },
257
- )
258
-
259
- const myExtension = createExtension().provides(myCustomRemoteAssetLoader);
260
- const cameraKit = bootstrapCameraKit(config, container => container.provides(myExtension));
261
- ```
262
-
263
- This also enables greater modularity – the person/team creating the extension can do so in their own package, which
264
- could be shared by many applications that all require the same functionality.
265
-
266
- #### Returns
267
-
268
- `PartialContainer`
269
-
270
- A PartialContainer which can be used to create a collection of Services, and can later be provided
271
- to CameraKit's DI container during [bootstrapCameraKit](modules.md#bootstrapcamerakit).
272
-
273
- ## Lenses
274
-
275
- ### LensMetricsEvents
276
-
277
- Ƭ **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)\>
278
-
279
- Lens metrics events.
280
-
281
- These events are emitted by [CameraKit](classes/CameraKit.md) to report lens usage, performance, apply latency, etc.
282
-
283
- ___
284
-
285
- ### AssetTiming
286
-
287
- Ƭ **AssetTiming**: ``"required"`` \| ``"onDemand"``
288
-
289
- Lens assets are included in a manifest, and each will indicate when that asset will be used by the lens.
290
-
291
- Assets can have the following timing values:
292
- - `required`: the lens will definitely request this asset immediately when the lens is applied.
293
- - `onDemand`: the lens may request this asset at some time while the lens is applied.
294
-
295
- Depending on the use-case, an application may want to cache both required and onDemand assets for
296
- a particular lens, or may decide to only cache required assets (or cache no assets).
297
-
298
- ___
299
-
300
- ### AssetLoader
301
-
302
- Ƭ **AssetLoader**: (`request`: [`LoadAssetRequest`](interfaces/LoadAssetRequest.md)) => `Promise`\<[`AssetResponse`](modules.md#assetresponse)\> \| [`AssetResponse`](modules.md#assetresponse)
303
-
304
- An AssetLoader is used to retrieve assets. A separate loader may be defined to retrieve different asset types.
305
-
306
- #### Type declaration
307
-
308
- ▸ (`request`): `Promise`\<[`AssetResponse`](modules.md#assetresponse)\> \| [`AssetResponse`](modules.md#assetresponse)
309
-
310
- ##### Parameters
311
-
312
- | Name | Type | Description |
313
- | :------ | :------ | :------ |
314
- | `request` | [`LoadAssetRequest`](interfaces/LoadAssetRequest.md) | The [LoadAssetRequest](interfaces/LoadAssetRequest.md) detailing the asset to be loaded, its context, and loading priority. |
315
-
316
- ##### Returns
317
-
318
- `Promise`\<[`AssetResponse`](modules.md#assetresponse)\> \| [`AssetResponse`](modules.md#assetresponse)
319
-
320
- ___
321
-
322
- ### LensView
323
-
324
- Ƭ **LensView**: `MakeTaggedBusinessEvent`\<``"lensView"``\>
325
-
326
- The LensView metric is emitted after a lens has been viewed (for longer than 100ms), when the lens is turned off.
327
-
328
- It contains information about rendering performance.
329
-
330
- Notes:
331
- - If the page is hidden (e.g. user switches to a different tab, or application, or closes the tab, or closes the
332
- browser, navigates to a new page, refreshes, etc.) this metric will be emitted at that time. This is to ensure
333
- we don't lose the metric if the page is closed.
334
- - If the page is hidden and then made visible again later (e.g. user switches to a different tab, then back), we
335
- will begin measuring a new LensView. That is, we will not capture the time when the page is hidden even if the
336
- lens is still rendering in the background.
337
-
338
- ___
339
-
340
- ### LensWait
341
-
342
- Ƭ **LensWait**: `MakeTaggedBusinessEvent`\<``"lensWait"``\>
343
-
344
- The LensWait metric measures the time spent downloading the lens content and required assets. It gives an indication
345
- of the real UX impact of download latency. If lens content and assets are pre-loaded, the latency measured here
346
- should decrease – we measure between the request to apply a lens and when the lens is ready to render.
347
-
348
- ___
349
-
350
- ### RenderTarget
351
-
352
- Ƭ **RenderTarget**: ``"live"`` \| ``"capture"``
353
-
354
- Enumerates the supported render targets.
355
-
356
- Lenses may render to different render targets, as designed by the lens creator. In CameraKit, it's possible to choose
357
- which render target to render, and the result for each target is available as a separate `<canvas>` element.
358
-
359
- ___
360
-
361
- ### CameraKitSessionEvents
362
-
363
- Ƭ **CameraKitSessionEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)\<``"error"``, \{ `error`: [`LensExecutionError`](modules.md#lensexecutionerror) \| [`LensAbortError`](modules.md#lensaborterror) \| [`LensImagePickerError`](modules.md#lensimagepickererror) ; `lens`: [`Lens`](interfaces/Lens.md) }\>
364
-
365
- Events emitted by [CameraKitSession.events](classes/CameraKitSession.md#events).
366
-
367
- The following events are emitted:
368
- - `error`: An error has been encountered during lens rendering. May contain an error of type:
369
- - [LensExecutionError](modules.md#lensexecutionerror) If an error of this type occurs, the rendering lens will be automatically removed
370
- from the associated CameraKitSession.
371
- - [LensImagePickerError](modules.md#lensimagepickererror)
372
-
373
- ___
374
-
375
- ### Keyboard
376
-
377
- Ƭ **Keyboard**: `Object`
378
-
379
- Keyboard is an API enabling lenses to consume and render user-generated text.
380
-
381
- Applications that wish to use lenses that expect user-generated text will need to use this API to integrate text
382
- input into their user experience.
383
-
384
- There are two ways to do this:
385
- 1. Add the provided DOM element (an HTMLTextAreaElement) to the page. When the user updates this element with text,
386
- that text will be sent to the currently active lens.
387
- 2. Use the [Keyboard.sendInputToLens](modules.md#sendinputtolens) method to send text strings to the currently active lens directly.
388
-
389
- Lenses will also signal to the application when text input is expected -- applications should add an event listener
390
- and ensure the user is able to input text when the `active` event is received.
391
-
392
- **`Example`**
393
-
394
- ```ts
395
- cameraKitSession.keyboard.addEventListener('active', ({ detail }) => {
396
- const { element, active } = detail
397
- if (active) document.body.appendChild(element)
398
- else element.remove()
399
- })
400
- ```
401
-
402
- #### Type declaration
403
-
404
- | Name | Type | Description |
405
- | :------ | :------ | :------ |
406
- | `addEventListener` | (`type`: ``"active"``, `callback`: `TypedEventListener`\<[`KeyboardEvents`](modules.md#keyboardevents)\>, `options?`: `TypedEventListenerOptions`) => `void` | - |
407
- | `removeEventListener` | (`type`: ``"active"``, `callback`: `TypedEventListener`\<[`KeyboardEvents`](modules.md#keyboardevents)\>) => `void` | - |
408
- | `getElement` | () => `HTMLTextAreaElement` | Get an HTMLTextAreaElement that communicates text to the active Lens. |
409
- | `sendInputToLens` | (`text`: `string`) => `void` | Send text to the active Lens. Also updates the provided HTMLTextAreaElement. |
410
- | `dismiss` | () => `void` | Clears the provided HTMLTextAreaElement, and emits the "active" event with `active == false`, allowing the application to e.g. remove relevant text input elements from the DOM. |
411
-
412
- ## Metrics
413
-
414
- ### LensMetricsEvents
415
-
416
- Ƭ **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)\>
417
-
418
- Lens metrics events.
419
-
420
- These events are emitted by [CameraKit](classes/CameraKit.md) to report lens usage, performance, apply latency, etc.
421
-
422
- ___
423
-
424
- ### LensView
425
-
426
- Ƭ **LensView**: `MakeTaggedBusinessEvent`\<``"lensView"``\>
427
-
428
- The LensView metric is emitted after a lens has been viewed (for longer than 100ms), when the lens is turned off.
429
-
430
- It contains information about rendering performance.
431
-
432
- Notes:
433
- - If the page is hidden (e.g. user switches to a different tab, or application, or closes the tab, or closes the
434
- browser, navigates to a new page, refreshes, etc.) this metric will be emitted at that time. This is to ensure
435
- we don't lose the metric if the page is closed.
436
- - If the page is hidden and then made visible again later (e.g. user switches to a different tab, then back), we
437
- will begin measuring a new LensView. That is, we will not capture the time when the page is hidden even if the
438
- lens is still rendering in the background.
439
-
440
- ___
441
-
442
- ### LensWait
443
-
444
- Ƭ **LensWait**: `MakeTaggedBusinessEvent`\<``"lensWait"``\>
445
-
446
- The LensWait metric measures the time spent downloading the lens content and required assets. It gives an indication
447
- of the real UX impact of download latency. If lens content and assets are pre-loaded, the latency measured here
448
- should decrease – we measure between the request to apply a lens and when the lens is ready to render.
449
-
450
- ## Other
451
-
452
- ### PublicServices
453
-
454
- Ƭ **PublicServices**: `ServicesFromInjectables`\<[`ReturnType`\<typeof `createCameraKitConfigurationFactory`\>, typeof `userDataAccessResolverFactory`, typeof [`filePickerFactory`](modules.md#filepickerfactory), typeof `defaultFetchHandlerFactory`, typeof `remoteMediaAssetLoaderFactory`, typeof [`lensSourcesFactory`](modules.md#lenssourcesfactory), typeof [`remoteApiServicesFactory`](modules.md#remoteapiservicesfactory), typeof `uriHandlersFactory`, typeof `externalMetricsSubjectFactory`]\>
455
-
456
- All services available to be customized by client app.
457
-
458
- ___
459
-
460
- ### RemoteApiStatus
461
-
462
- Ƭ **RemoteApiStatus**: ``"success"`` \| ``"redirected"`` \| ``"badRequest"`` \| ``"accessDenied"`` \| ``"notFound"`` \| ``"timeout"`` \| ``"requestTooLarge"`` \| ``"serverError"`` \| ``"cancelled"`` \| ``"proxyError"``
463
-
464
- Status of a Remote API response.
465
-
466
- ___
467
-
468
- ### RemoteApiCancelRequestHandler
469
-
470
- Ƭ **RemoteApiCancelRequestHandler**: () => `void`
471
-
472
- Represents a Remote API request cancellation handler function.
473
-
474
- #### Type declaration
475
-
476
- ▸ (): `void`
477
-
478
- ##### Returns
479
-
480
- `void`
481
-
482
- ___
483
-
484
- ### RemoteApiRequestHandler
485
-
486
- Ƭ **RemoteApiRequestHandler**: (`reply`: (`response`: [`RemoteApiResponse`](interfaces/RemoteApiResponse.md)) => `void`) => [`RemoteApiCancelRequestHandler`](modules.md#remoteapicancelrequesthandler) \| `void`
487
-
488
- Represents a Remote API request handler function.
489
- It is provided with a reply callback that must be invoked to send a response back to the lens.
490
- The reply callback can be invoked multiple times if needed.
491
- Additionally, the handler can return a cancellation callback, which is triggered when the lens cancels the request.
492
-
493
- #### Type declaration
494
-
495
- ▸ (`reply`): [`RemoteApiCancelRequestHandler`](modules.md#remoteapicancelrequesthandler) \| `void`
496
-
497
- ##### Parameters
498
-
499
- | Name | Type |
500
- | :------ | :------ |
501
- | `reply` | (`response`: [`RemoteApiResponse`](interfaces/RemoteApiResponse.md)) => `void` |
502
-
503
- ##### Returns
504
-
505
- [`RemoteApiCancelRequestHandler`](modules.md#remoteapicancelrequesthandler) \| `void`
506
-
507
- ___
508
-
509
- ### RemoteApiServices
510
-
511
- Ƭ **RemoteApiServices**: [`RemoteApiService`](interfaces/RemoteApiService.md)[]
512
-
513
- ___
514
-
515
- ### FetchHandler
516
-
517
- Ƭ **FetchHandler**\<`R`\>: (`input`: `RequestInfo`, `init?`: `RequestInit`) => `Promise`\<`R`\>
518
-
519
- #### Type parameters
520
-
521
- | Name | Type |
522
- | :------ | :------ |
523
- | `R` | `Response` |
524
-
525
- #### Type declaration
526
-
527
- ▸ (`input`, `init?`): `Promise`\<`R`\>
528
-
529
- ##### Parameters
530
-
531
- | Name | Type |
532
- | :------ | :------ |
533
- | `input` | `RequestInfo` |
534
- | `init?` | `RequestInit` |
535
-
536
- ##### Returns
537
-
538
- `Promise`\<`R`\>
539
-
540
- ___
541
-
542
- ### FilePickerOptions
543
-
544
- Ƭ **FilePickerOptions**: `Parameters`\<`OpenDefaultFilePicker`\>[``0``]
545
-
546
- File picker options. For example, it indicates which MIME types of files are expected to be picked.
547
-
548
- ___
549
-
550
- ### FilePickerResult
551
-
552
- Ƭ **FilePickerResult**: `Promise`\<`FileWithHandle` \| `FileWithHandle`[]\>
553
-
554
- File picker dialog result object, which is a Promise that resolves to a file or an array of files with handles.
555
-
556
- ___
557
-
558
- ### FilePicker
559
-
560
- Ƭ **FilePicker**: (`options`: [`FilePickerOptions`](modules.md#filepickeroptions), `openDefaultPicker`: `OpenDefaultFilePicker`) => [`FilePickerResult`](modules.md#filepickerresult)
561
-
562
- A callback to show a file picker dialog.
563
-
564
- #### Type declaration
565
-
566
- ▸ (`options`, `openDefaultPicker`): [`FilePickerResult`](modules.md#filepickerresult)
567
-
568
- ##### Parameters
569
-
570
- | Name | Type | Description |
571
- | :------ | :------ | :------ |
572
- | `options` | [`FilePickerOptions`](modules.md#filepickeroptions) | Options for the file picker dialog. |
573
- | `openDefaultPicker` | `OpenDefaultFilePicker` | The default file picker function. The client app may choose to use the default file picker. |
574
-
575
- ##### Returns
576
-
577
- [`FilePickerResult`](modules.md#filepickerresult)
578
-
579
- ___
580
-
581
- ### Uri
582
-
583
- Ƭ **Uri**: \`$\{string}://$\{string}\`
584
-
585
- ___
586
-
587
- ### LensLaunchParams
588
-
589
- Ƭ **LensLaunchParams**: `Record`\<`string`, `string` \| `number` \| `string`[] \| `number`[]\>
590
-
591
- Lens launch params.
592
-
593
- ___
594
-
595
- ### Zodiac
596
-
597
- Ƭ **Zodiac**: ``"aquarius"`` \| ``"aries"`` \| ``"cancer"`` \| ``"capricorn"`` \| ``"gemini"`` \| ``"leo"`` \| ``"libra"`` \| ``"pisces"`` \| ``"sagittarius"`` \| ``"scorpio"`` \| ``"taurus"`` \| ``"virgo"``
598
-
599
- ___
600
-
601
- ### AssetResponse
602
-
603
- Ƭ **AssetResponse**: `ArrayBuffer` \| \{ `data`: `ArrayBuffer` ; `checksum?`: `string` }
604
-
605
- ___
606
-
607
- ### LegalError
608
-
609
- Ƭ **LegalError**: `NamedError`\<``"LegalError"``\>
610
-
611
- ___
612
-
613
- ### LensContentValidationError
614
-
615
- Ƭ **LensContentValidationError**: `NamedError`\<``"LensContentValidationError"``\>
616
-
617
- ___
618
-
619
- ### LensError
620
-
621
- Ƭ **LensError**: `NamedError`\<``"LensError"``\>
622
-
623
- ___
624
-
625
- ### CameraKitSourceError
626
-
627
- Ƭ **CameraKitSourceError**: `NamedError`\<``"CameraKitSourceError"``\>
628
-
629
- ___
630
-
631
- ### LensImagePickerError
632
-
633
- Ƭ **LensImagePickerError**: `NamedError`\<``"LensImagePickerError"``\>
634
-
635
- The error triggered when a lens prompts the user to select an image, but the image fails to be successfully delivered
636
- to the lens.
637
-
638
- ___
639
-
640
- ### CacheKeyNotFoundError
641
-
642
- Ƭ **CacheKeyNotFoundError**: `NamedError`\<``"CacheKeyNotFoundError"``\>
643
-
644
- ___
645
-
646
- ### WebGLError
647
-
648
- Ƭ **WebGLError**: `NamedError`\<``"WebGLError"``\>
649
-
650
- ___
651
-
652
- ### BenchmarkError
653
-
654
- Ƭ **BenchmarkError**: `NamedError`\<``"BenchmarkError"``\>
655
-
656
- ___
657
-
658
- ### LensExecutionError
659
-
660
- Ƭ **LensExecutionError**: `NamedError`\<``"LensExecutionError"``\>
661
-
662
- This error occurs if a Lens is unable to continue rendering.
663
-
664
- If this error occurs, Camera Kit automatically removes the Lens from the session.
665
- It's always a good idea to handle this error and update the user experience accordingly.
666
- For example, you could remove the faulty Lens from your Lens selection UI.
667
-
668
- ```ts
669
- cameraKitSession.events.addEventListener('error', ({ detail }) => {
670
- if (detail.error.name === 'LensExecutionError') {
671
- console.log(`Lens ${detail.lens.name} encountered an error and was removed. Please pick a different lens.`)
672
- }
673
- })
674
- ```
675
-
676
- ___
677
-
678
- ### LensAbortError
679
-
680
- Ƭ **LensAbortError**: `NamedError`\<``"LensAbortError"``\>
681
-
682
- This error occurs when a session becomes inoperable.
683
-
684
- It's always a good idea to handle this error and update the user experience accordingly.
685
- For example, you could show a message to a user.
686
-
687
- ```ts
688
- cameraKitSession.events.addEventListener('error', ({ detail }) => {
689
- if (detail.error.name === 'LensAbortError') {
690
- console.log(`Camera Kit encountered an unrecoverable error and became inoperable. Please refresh the page.`)
691
- }
692
- })
693
- ```
694
-
695
- ___
696
-
697
- ### PersistentStoreError
698
-
699
- Ƭ **PersistentStoreError**: `NamedError`\<``"PersistentStoreError"``\>
700
-
701
- Error thrown when LensCore asked to store lens data, but CameraKit failed storing that.
702
-
703
- ___
704
-
705
- ### LensAssetError
706
-
707
- Ƭ **LensAssetError**: `NamedError`\<``"LensAssetError"``\>
708
-
709
- Error thrown when LensCore asked to provide an asset, but CameraKit failed providing that.
710
-
711
- ___
712
-
713
- ### ArgumentValidationError
714
-
715
- Ƭ **ArgumentValidationError**: `NamedError`\<``"ArgumentValidationError"``\>
716
-
717
- Thrown when a method receives an argument with an unexpected value.
718
-
719
- ___
720
-
721
- ### CameraKitSessionEventListener
722
-
723
- Ƭ **CameraKitSessionEventListener**: `TypedEventListener`\<[`CameraKitSessionEvents`](modules.md#camerakitsessionevents)\>
724
-
725
- Listener of [CameraKitSessionEvents](modules.md#camerakitsessionevents) events.
726
-
727
- ___
728
-
729
- ### KeyboardEvents
730
-
731
- Ƭ **KeyboardEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)\<``"active"``, \{ `element`: `HTMLTextAreaElement` ; `active`: `boolean` ; `lens?`: [`Lens`](interfaces/Lens.md) }\>
732
-
733
- Events emitted by [Keyboard](modules.md#keyboard).
734
-
735
- ___
736
-
737
- ### Matrix
738
-
739
- Ƭ **Matrix**: `TupleOf`\<`number`, ``9``\>
740
-
741
- Matrix as a 9-value array in column-major order,
742
- where elements are stored sequentially by columns.
743
-
744
- ___
745
-
746
- ### extensionRequestContext
747
-
748
- • `Const` **extensionRequestContext**: `ArrayBuffer`
749
-
750
- Extension request context.
751
-
752
- ___
753
-
754
- ### remoteApiServicesFactory
755
-
756
- ▸ **remoteApiServicesFactory**(`...args`): [`RemoteApiServices`](modules.md#remoteapiservices)
757
-
758
- #### Parameters
759
-
760
- | Name | Type |
761
- | :------ | :------ |
762
- | `...args` | [] |
763
-
764
- #### Returns
765
-
766
- [`RemoteApiServices`](modules.md#remoteapiservices)
767
-
768
- ___
769
-
770
- ### filePickerFactory
771
-
772
- ▸ **filePickerFactory**(`...args`): [`FilePicker`](modules.md#filepicker)
773
-
774
- Default file picker factory function. The file picker is triggered when a lens issues a file request.
775
- Client applications can override this factory function to provide their custom file picker.
776
-
777
- #### Parameters
778
-
779
- | Name | Type |
780
- | :------ | :------ |
781
- | `...args` | [] |
782
-
783
- #### Returns
784
-
785
- [`FilePicker`](modules.md#filepicker)
786
-
787
- ___
788
-
789
- ### lensSourcesFactory
790
-
791
- ▸ **lensSourcesFactory**(`...args`): [`LensSource`](interfaces/LensSource.md)[]
792
-
793
- By default, no custom [LensSource](interfaces/LensSource.md) is provided to CameraKit. But to enable certain advanced use-cases,
794
- applications may provide their own [LensSource](interfaces/LensSource.md).
795
-
796
- Perhaps the most convenient way to do this is with ConcatInjectable, as shown here:
797
-
798
- #### Parameters
799
-
800
- | Name | Type |
801
- | :------ | :------ |
802
- | `...args` | [] |
803
-
804
- #### Returns
805
-
806
- [`LensSource`](interfaces/LensSource.md)[]
807
-
808
- **`Example`**
809
-
810
- ```ts
811
- import { bootstrapCameraKit, lensSourcesFactory, LensSource } from '@snap/camera-kit'
812
-
813
- const cameraKit = bootstrapCameraKit(config, (container) => {
814
- return container.provides(ConcatInjectable(
815
- lensSourcesFactory.token,
816
- (): LensSource => { return ... }
817
- ))
818
- })
819
- ```
820
-
821
- ## Rendering
822
-
823
- ### RenderTarget
824
-
825
- Ƭ **RenderTarget**: ``"live"`` \| ``"capture"``
826
-
827
- Enumerates the supported render targets.
828
-
829
- Lenses may render to different render targets, as designed by the lens creator. In CameraKit, it's possible to choose
830
- which render target to render, and the result for each target is available as a separate `<canvas>` element.
831
-
832
- ___
833
-
834
- ### CameraKitSessionEvents
835
-
836
- Ƭ **CameraKitSessionEvents**: [`TypedCustomEvent`](classes/TypedCustomEvent.md)\<``"error"``, \{ `error`: [`LensExecutionError`](modules.md#lensexecutionerror) \| [`LensAbortError`](modules.md#lensaborterror) \| [`LensImagePickerError`](modules.md#lensimagepickererror) ; `lens`: [`Lens`](interfaces/Lens.md) }\>
837
-
838
- Events emitted by [CameraKitSession.events](classes/CameraKitSession.md#events).
839
-
840
- The following events are emitted:
841
- - `error`: An error has been encountered during lens rendering. May contain an error of type:
842
- - [LensExecutionError](modules.md#lensexecutionerror) If an error of this type occurs, the rendering lens will be automatically removed
843
- from the associated CameraKitSession.
844
- - [LensImagePickerError](modules.md#lensimagepickererror)
845
-
846
- ___
847
-
848
- ### createImageSource
849
-
850
- ▸ **createImageSource**(`image`, `options?`): [`CameraKitSource`](classes/CameraKitSource.md)
851
-
852
- Create a [CameraKitSource](classes/CameraKitSource.md) from an
853
- [HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement).
854
-
855
- #### Parameters
856
-
857
- | Name | Type | Description |
858
- | :------ | :------ | :------ |
859
- | `image` | `HTMLImageElement` | Image element. |
860
- | `options` | `Partial`\<[`CameraKitDeviceOptions`](interfaces/CameraKitDeviceOptions.md)\> | Options. |
861
-
862
- #### Returns
863
-
864
- [`CameraKitSource`](classes/CameraKitSource.md)
865
-
866
- ___
867
-
868
- ### createMediaStreamSource
869
-
870
- ▸ **createMediaStreamSource**(`stream`, `options?`): [`CameraKitSource`](classes/CameraKitSource.md)
871
-
872
- Create a [CameraKitSource](classes/CameraKitSource.md) from any
873
- [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream).
874
-
875
- #### Parameters
876
-
877
- | Name | Type | Description |
878
- | :------ | :------ | :------ |
879
- | `stream` | `MediaStream` | Any MediaStream, such as obtained via `canvas.captureStream()` or `mediaDevices.getUserMedia()`. |
880
- | `options` | `Partial`\<[`MediaStreamSourceOptions`](interfaces/MediaStreamSourceOptions.md)\> | Options. |
881
-
882
- #### Returns
883
-
884
- [`CameraKitSource`](classes/CameraKitSource.md)
885
-
886
- ___
887
-
888
- ### createVideoSource
889
-
890
- ▸ **createVideoSource**(`video`, `options?`): [`CameraKitSource`](classes/CameraKitSource.md)
891
-
892
- Create a [CameraKitSource](classes/CameraKitSource.md) from an
893
- [HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).
894
-
895
- #### Parameters
896
-
897
- | Name | Type | Description |
898
- | :------ | :------ | :------ |
899
- | `video` | `HTMLVideoElement` | CameraKit performs best when the source video is 720p – arbitrary resolutions are supported, but very high resolutions may not perform well. |
900
- | `options` | `Partial`\<[`VideoSourceOptions`](interfaces/VideoSourceOptions.md)\> | Options. |
901
-
902
- #### Returns
903
-
904
- [`CameraKitSource`](classes/CameraKitSource.md)