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.

    Lens Scripting Version 173

    // @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

    Lens Scripting Version 176

    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

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

      Parameters

      Returns void

      Lens Scripting Version 179

    • Parameters

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

      Returns void

      Lens Scripting Version 320

    • Download the file from the DynamicResource object and loads the resource as a GaussianSplattingAsset. Supported file formats: .ply, .gs, .gsaf, .gfrosting

      Parameters

      Returns void

      Lens Scripting Version 320

      // @input Asset.RemoteMediaModule mediaModule
      // @input string url

      let gsVisual = script.getSceneObject().getComponent("Component.GaussianSplattingVisual")
      function success(gsa) { gsVisual.asset = gsa }
      function fail(msg) { print('Error: ' + msg) }
      const resource = DynamicResource.createWithResourceId(script.url)
      script.mediaModule.loadResourceAsGaussianSplattingAsset(resource, success, fail)
    • Downloads a remote 3D GLTF file given a DynamicResource.

      Parameters

      Returns void

      Lens Scripting Version 173

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

      Parameters

      Returns void

      Lens Scripting Version 179

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

      If the runtime bundle uses any permission-requiring modules (e.g. CameraModule), those permissions must be declared in the original Lens that loads the bundle. Use require statements in the parent Lens script to declare them; the runtime bundle itself cannot request permissions on its own. Omitting the required require calls will not cause an error in Lens Studio but will be blocked by permission checks at runtime on device.

      Parameters

      Returns void

      Lens Scripting Version 328

      // Declare permissions for any modules used inside the runtime bundle:
      require('LensStudio:CameraModule');
      require('LensStudio:SpectaclesMobileKitModule');
      require('LensStudio:SupabaseModule');
      // ...

      const internetModule = require('LensStudio:InternetModule');
      const remoteMediaModule = require('LensStudio:RemoteMediaModule');

      var response = await internetModule.fetch("runtimeBundleUrl");
      var blob = await response.blob();
      var dynamicResource = DynamicResource.createWithBuffer(await blob.bytes());
      remoteMediaModule.loadResourceAsRuntimeBundle(
      dynamicResource,
      function(asset) { print('Loaded: ' + asset); },
      function(err) { print('Error: ' + err); }
      );
    • Parameters

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

      Returns void

      Lens Scripting Version 320

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

      Parameters

      Returns void

      Lens Scripting Version 179