Skip to main content

Remote Assets

Load textures, audio, and other resources hosted by the connected mobile app into a Lens on SPECS with Mobile Kit and the spectacleskit:// scheme.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported
  • SPECSFully supported
  • Camera Kit WebNot supported
  • Camera Kit MobileNot supported

Platform details

  • Snapchat — Not supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported.

  • Camera Kit Mobile — Not supported.

To load remote resources (for example, texture, audio or other resources) hosted by the connected mobile application, use the spectacleskit:// scheme. This works with the RemoteMediaModule.

const remoteMediaModule = require('LensStudio:RemoteMediaModule')

const textureId = 'spectacleskit://test.png'
remoteMediaModule.loadAsImageTexture(
textureId,
(texture) => {
mainPass.baseTex = texture
},
(error) => {
print(`Error loading asset: ${error}`)
}
)

const meshId = 'spectacleskit://test.glb'
remoteMediaModule.loadAsGltfAsset(
meshId,
(asset) => {
asset.tryInstantiate(
script.gltfContainer,
script.gltfMaterial
)
// You can now find a new object in script.gltfContainer
},
(error)=> {
print(`Error loading asset: ${error}`)
}
)