Skip to main content

Remote Assets

To load remote resources (e.g., 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}`)
}
)
Was this page helpful?
Yes
No