When using an API which provides access to the internet or communication with other Lens sessions like RemoteServiceModule, CloudStorageModule, InternetModule, or ConnectedLensModule, your access to APIs which provide information about the current user will be restricted. This is to protect the privacy of those users and have their data stay only in the local Lens session.
| API | Description |
|---|---|
| ScanModule | Provides access to a Scan system that allows users to scan objects, places, and cars with a database of item labels within a Lens. |
| ScanModule.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| ScanModule.scan | Starts a single Scan call using the provided list of ScanModule.Contexts. On success it will invoke scanComplete providing a JSON string. On failure it will invoke onFailure with a failure message passed in as an argument. |
| AsrModule.startTranscribing | Starts a new ASR session. While active the Lens will transcribe speech to text. |
| AsrModule.stopTranscribing | Stops an active ASR Session before transcription is finished and discards the current session. |
| DeviceInfoSystem.getOS | Returns the operating system type of the device. |
| LocalizationSystem.getLanguage | Returns the language code of the language being used on the device. Example: "en" (for English) |
| LocalizationSystem.localize | The method takes a localization key and returns the localized string according to device language. Useful for localizing strings before formatting them and assigning them to Text. |
| UserContextSystem.requestBirthdate | Provides the user's birth date as a Date object. |
| UserContextSystem.requestBirthdateFormatted | Provides the user's birth date as localized string. |
| UserContextSystem.requestCity | Provides the name of the city the user is currently located in. |
| UserContextSystem.requestUsername | Provides the user's username. |
| UserContextSystem.getAllFriends | Retrieve the Snapchatter's friends list in order to access details like display name, birthdate, or Bitmoji |
| UserContextSystem.getBestFriends | Retrieve the Snapchatter's best friends in order to access details like display name, birthdate, or Bitmoji. |
| UserContextSystem.getPinnedBestFriends | Retrieve the Snapchatter's pinned best friends in order to access details like display name, birthdate, or Bitmoji. |
| UserContextSystem.getUsersInCurrentContext | Gets the list of friends in the current context, such as 1:1 chats, 1:many chats, and group chats. |
| UserContextSystem.getFriendsWithAvailableMySelfie | Retrieve the Snapchatter's friends who have a My Selfie identity that the current user is permitted to use for generation, in order to access details like display name, birthdate, or Bitmoji. |
| UserContextSystem.getCurrentUser | Retrieve a SnapchatUser representing the current user. |
| UserContextSystem.getMyAIUser | Retrieve a SnapchatUser object for MyAI which you can use to access the MyAI Bitmoji or other details. |
| Leaderboard.submitScore | Submit a score to the leaderboard. The success callback hands back the submitting user's own record, which carries their full information, so this exposes user data and cannot be combined with network modules such as ConnectedLensModule. Use Leaderboard#submitScoreSafeInfo when the Lens also needs a network module. |
| Leaderboard.getLeaderboardInfo | Get information about the leaderboard, such as who is on it. The records returned carry other users' full information, so this exposes user data and cannot be combined with network modules such as ConnectedLensModule. |
| CameraFrame | An entity which provided metadata about the current camera image provided by CameraTextureProvider. Modeled after VideoFrame web API. |
| CameraFrame.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| ProceduralTextureProvider.getPixels | Returns a Uint8 array containing the pixel values in a region of the texture. The region starts at the pixel coordinate x, y, and extends rightward by width and upward by height. Values returned are integers ranging from 0 to 255 |
| ProceduralTextureProvider.getPixelsFloat32 | Returns a Float32 array containing the pixel values in a region of the texture. The region starts at the pixel coordinates x, y, and extends rightward by width and upward by height. |
| LocationService.getCurrentPosition | Retrieves the device's current location. |
| LocationAsset.fromSerialized | Deserialize the provided serialized LocationAsset. |
| LocationAsset.toSerialized | Serialize the LocationAsset to a string representation. |
| AnchorLocationModule.getGeoPosition | Get the real-world latitude/longitude of an anchor. Requires the user's location permission. |
| CameraModule | Provides access to a specific camera on Spectacles device. |
| CameraModule.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.createCameraRequest | Creates a camera request object. |
| CameraModule.createImageRequest | Spectacles: create a CameraImage.ImageRequest. This object can be used to configure a request for a high resolution image of the user's camera stream. The resolution of this image will be fixed to 3200x2400. |
| CameraModule.requestCamera | Returns a Texture whose provider is CameraTextureProvider which provides images from the requested camera ID. |
| CameraModule.requestImage | Spectacles: Request a still image of the user's camera stream. Unlike {@CameraModule.requestCamera}, this method takes more time but yields a higher resolution image (3200x2400) suitable for tasks like OCR. This method is asynchronous and when complete will return an ImageFrame that contains a {@Texture } that can be attached to a visual.js<br>let cameraModule = require("LensStudio:CameraModule");<br>let imageRequest = CameraModule.createImageRequest();<br>try {<br>let imageFrame = await cameraModule.requestImage(imageRequest);<br>// Use the texture in some visual<br>script.image.mainPass.baseTex = imageFrame.texture;<br>let timestamp = imageFrame.timestampMillis; // scene-relative time<br>} catch (error) {<br>print(`Still image request failed: ${error}`);<br>}<br> |
| CameraModule.getSupportedImageResolutions | Get the list of resolutions this hardware camera can provide. |
| CameraModule.getSupportedStreams | Spectacles: Query available camera streams. Each entry is a valid camera + resolution + format + frame rate combination. Results are sorted descending by pixel area so the highest-resolution stream is first. |
| CameraModule.createStreamingSession | Spectacles: Create a streaming camera session for continuous frame delivery. Configure with a CameraModule.StreamConfig and start with CameraModule.StreamingSession#start. Sessions are restartable; call CameraModule.StreamingSession#stop to release the camera. |
| CameraModule.createCaptureSession | Spectacles: Create a still-capture session. The capture pipeline is pre-warmed in CameraModule.CaptureSession#start; trigger individual captures with CameraModule.CaptureSession#capture which returns a Promise that resolves with the captured Frame. |
| ImageFrame | Spectacles: ImageFrame contains the results of a still image request initiated from the CameraModule. Still images are high resolution images of the user's current camera stream. |
| ImageFrame.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| DepthTextureProvider.sampleDepthAtPoint | Get the depth at the given point |
| DepthModule | Provides access to a DepthFrameSession on Spectacles device. |
| DepthModule.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| DepthModule.createDepthFrameSession | Create a DepthFrameSession. |
| DepthFrameSession | Used for receiving DepthFrameData on Spectacles device. |
| DepthFrameSession.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| DepthFrameSession.start | Starts depth estimation for the DepthFrameSession on Spectacles. |
| DepthFrameSession.stop | Stops depth estimation for the DepthFrameSession on Spectacles. |
| DepthFrameData | The depth frame data as provided by the DepthFrameSession.onNewFrame. |
| DepthFrameData.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| DeviceTracking.getPointCloud | Returns the 3D point cloud representing important features visible by the camera. |
| MicrophoneAudioProvider.getAudioFrame | Writes current frame audio data to the passed in Float32Array and returns its shape. The length of the array can't be more than maxFrameSize. |
| MicrophoneAudioProvider.getAudioFramePCM16 | Retrieves the current audio frame, converts it to PCM16 (Pulse-Code Modulation) format, and writes the raw audio samples into the provided audioFrame as an Int16Array. The length of the array can’t be more than maxFrameSize. |
| CameraModule.CameraRequest | An object that is used to request the desired camera ID. It should be passed to the CameraModule to get back a camera texture. |
| CameraModule.CameraRequest.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.ImageRequest | Spectacles: ImageRequest contains the parameterization for a still image request, which is a request for a high resolution image of the user's current camera stream. |
| CameraModule.ImageRequest.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.Frame | Camera frame data delivered via CameraModule.StreamingSession#onNewFrame, or returned by CameraModule.CaptureSession#capture. |
| CameraModule.Frame.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.Frame.getMetadata | Get a frame metadata value by key. |
| CameraModule.StreamInfo | Describes a supported camera stream configuration (read-only). |
| CameraModule.StreamInfo.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.StreamConfig | Stream configuration for creating a camera session. |
| CameraModule.StreamConfig.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.StreamConfig.setConfig | Set a tuning parameter. |
| CameraModule.StreamConfigOverrides | Per-shot overrides for CameraModule.CaptureSession#capture. |
| CameraModule.StreamConfigOverrides.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.StreamFilter | Filter for narrowing stream discovery results. |
| CameraModule.StreamFilter.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.StreamingSession | Continuous-frame camera session for Spectacles. Created via CameraModule#createStreamingSession. After CameraModule.StreamingSession#start, frames are delivered via CameraModule.StreamingSession#onNewFrame until CameraModule.StreamingSession#stop is called. |
| CameraModule.StreamingSession.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.StreamingSession.start | Start continuous frame delivery. The configured stream is opened and frames begin flowing to onNewFrame. |
| CameraModule.StreamingSession.setConfig | Reconfigure a dynamic parameter on a live streaming session. Only dynamic ConfigKeys (Iso, ExposureTimeNs, AeRoi) can be changed mid-stream. Static keys return Result.InvalidConfig. |
| CameraModule.StreamingSession.stop | Stop the session and release the underlying camera stream. Restartable: call CameraModule.StreamingSession#start again. |
| CameraModule.CaptureSession | Still-capture camera session for Spectacles. Created via CameraModule#createCaptureSession. After CameraModule.CaptureSession#start pre-warms the pipeline, individual snapshots are triggered with CameraModule.CaptureSession#capture, which returns a Promise that resolves with the captured Frame. |
| CameraModule.CaptureSession.getTypeName | Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName(). |
| CameraModule.CaptureSession.start | Pre-warm the capture pipeline. Call early (e.g. on Lens load) for low shutter latency. No frames are delivered until CameraModule.CaptureSession#capture is invoked. |
| CameraModule.CaptureSession.capture | Trigger a single still capture. Returns a Promise that resolves with the captured CameraModule.Frame once the frame is delivered (typically within a few hundred ms on a pre-warmed session). Only one capture may be in flight per session: await the returned Promise before calling capture() again. The Promise rejects when: - the session is not started or was stopped/disconnected, - another capture is already in flight, - stop() is called before the frame lands, - no frame is delivered within 30 seconds (pipeline stall backstop). If the camera service delivers a frame whose image data cannot be read, the Promise still resolves, with a Frame whose CameraModule.Frame#texture is null and CameraModule.Frame#imageData is empty — check for a null texture before using the result. |
| CameraModule.CaptureSession.stop | Stop the session and release the underlying capture pipeline. Restartable: call CameraModule.CaptureSession#start again. |
| Base64.encodeTextureAsync | Encode a texture according to Base64 encoding algorithm, asynchronously. |
| TensorMath.textureToGrayscale | Converts the texture to a set of 0-255 grayscale values, and outputs the result into outTensor.outTensor should be a Uint8Array of shape {width, height, 1}. |