Connected Lenses Overview
Connected Lenses are a type of Lens that allows you to pass and store data between devices that are running the same Lens, whether they’re in the same location or in different locations. Connected Lenses allow you to create AR experiences that friends can experience together at the same time, and return to over time.
Warning: This feature is in Beta and is not available for use in Sponsored Lenses
Note: You can build simple Connected experiences--allowing the Snapchatters to instantiate objects, modify the position/rotation/scale of an object in sync across devices, as well as send messages--through the Connected Lens Template.
The left image shows friends playing in a colocated space. The right shows friends playing in a remote space.
Remote and Colocated
Connected Lenses can be experienced whether the participating Snapchatters are together or apart. In other words, you can create a Connected Lens experience which is:
- Remote: You and your friends can be connected to a shared session in a Lens where you can share data back and forth.
- To invite your friends to a remote experience, the Lens will allow you to send a message to your friends to invite them to the experience.
- Colocated: In addition to the capabilities above, when in the same location, you and your friends can reference the same World Tracked experience on your individual devices.
- To invite your friends to a Colocated experience, one user first needs to map your area, then the Lens can show a Snapcode that your friends can scan to join the experience.
- The mapped area will not provide the geometry of the scene, it will only allow you to share the same coordinate frame between participants.
A single Lens can contain a single-user experience, a remote experience, as well as a colocated experience--though you will have to manage this logic yourself.
Note: In a remote experience, you can invite friends via a group chat (which can include friends of friends) to join. In colocated, however, only the creator of the session can invite, and all participants must be a friend of the creator.
Differences of a Connected Lens
At the core of a Connected Lens, is the ability for the Lens to create a session that can be joined by others. This capability is enabled by the
ConnectedLensModule. Adding this module makes your Lens a Connected Lens which has some differences.
Tip: In a remote setting, the session corresponds to a 1 on 1, or group chat.
Call to Action
If your Lens includes a ConnectedLensModule, your Lens will have a Call to Action button that users will tap to enter into a full screen state (the “Connected Lens State”) at which point you can provide the functionality for them to invite others into a session. When a user enters a Lens through an invitation (chat or Snapcode), the user will enter directly into the “Connected Lens State”.
At this point:
- The user will not have access to any camera mode, except to change between front and rear camera.
- Instead of a carousel of Lenses, you will have an Action bar (similar to what you see in Snap Games). The Action Bar will allow the user to see who else is in the session.
Tip: The Action Bar takes care of additional "Connected" experience such as written and audio chat systems!
Once a user is connected to a session, the user will then need to invite others into either the colocated (via Snapcode) or remote (via Chat) session. The Connected Lens template provides this invitation flow so you can focus on developing your experience.
Tip: You'll usually also add the option for a "solo" mode here so that your experience is still usable even when the Snapchatter's friend is not available.
Relay Messaging & User Info
Connected Lenses do not rely on server-side logic to manage the state of each user. Within a session, a user sends a message to everyone, as well as receives messages from everyone. To help facilitate communication, each participant in a session will also be assigned a user id for that session.
With Connected Lenses, you can make a Lens that is meant to be experienced together in real time, but you can also make one that can be experienced asynchronously by storing data in a session to a shared persistent storage. This allows you to build a Lens that users will want to come back to again and again!
Since a session is tied to other mechanisms, so will the Lens ability to access the shared persistent storage. That is:
- A remote session can be rejoined as long as the chat conversation exists (e.g. it’s retention is based on the conversation’s settings)
- A colocated session can be rejoined as long as you have access to the Snapcode that was generated to enter the session.
When Using Connected Lenses, some APIs will be restricted in order to protect the user’s privacy. The following APIs will be disabled:
- UserContextSystem: requestBirthdate, requestBirthdateFormatted, requestCity
- Text component: Reading from text property when Dynamic Text is being used
- ProceduralTextureProvider: getPixels
- DepthTextureProvider: getDepth
- DeviceTracking: hitTestWorldMesh, raycastWorldMesh, getPointCloud
- DeviceLocationTrackingComponent: distanceToLocation
- OutputPlaceholder: data
- MicrophoneAudioProvider: getAudioFrame
- TensorMath: textureToGrayscale
- LocalizationSystem: getLanguage
Building a Connected Lens
With an understanding of what makes a Lens "Connected", take a look at the following pages to get started developing your own Connected Lens experience.
Still Looking for help?Visit Support