Preparing search index...

    Class RemoteMediaModule

    Allows the Lens to download and integrate remote media content such as 3D GLTF assets, images, audio tracks, and video textures into Lenses.

    // @input Asset.BitmojiModule bitmojiModule
    // @input Asset.RemoteMediaModule remoteMediaModule
    // @input Asset.Material pbrMaterialHolder

    script.bitmojiModule.requestBitmoji3DResource(
    function (bitmoji3DResource) {
    script.remoteMediaModule.loadResourceAsGltfAsset(
    bitmoji3DResource,
    onDownloaded,
    onFail
    )
    }
    )

    function onDownloaded (gltfAsset){
    var root = scene.createSceneObject("BitmojiAvatar");
    var avatar = gltfAsset.tryInstantiate(root, script.pbrMaterialHolder);
    }

    function onFail (e){
    print(e);
    }

    Hierarchy (View Summary)

    Index

    Properties

    name: string

    The name of the Asset in Lens Studio.

    uniqueIdentifier: string

    Methods

    • Returns the name of this object's type.

      Returns string

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Parameters

      • resource: DynamicResource
      • onSuccess: (bytes: Uint8Array) => void
      • onFailure: (errorMessage: string) => void

      Returns void

    • Parameters

      Returns void

      // Print the texture's height, width
      // Change the texture's name and print it out
      //@input Asset.Texture texture

      print("Width = " + script.texture.getWidth().toString());
      print("Height = " + script.texture.getHeight().toString());
      // Takes a screenshot of device camera input and applies it to meshVisual
      //@input Asset.Texture deviceCameraTexture
      //@input Component.MeshVisual meshVisual
      var textureCopy = script.deviceCameraTexture.copyFrame();
      script.meshVisual.mainPass.baseTex = textureCopy;
    • Downloads a remote 3D GLTF file given a DynamicResource.

      Parameters

      Returns void

    • Downloads the remote image resource from the DynamicResource object and loads the resource as an Image Texture.

      Parameters

      Returns void

    • Downloads the remote asset resource from the DynamicResource object and loads the resource as an Asset.

      Parameters

      Returns void

    • Parameters

      • resource: DynamicResource
      • onSuccess: (string: string) => void
      • onFailure: (errorMessage: string) => void

      Returns void

    • Downloads the remote image resource from the DynamicResource object and loads the resource as a VideoTextureProvider.

      Parameters

      Returns void