Provides access to a remote media.

// @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);
}
interface RemoteMediaModule {
    name: string;
    uniqueIdentifier: string;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    loadResourceAsAudioTrackAsset(resource: DynamicResource, onSuccess: ((glTFAsset: AudioTrackAsset) => void), onFailure: ((errorMessage: string) => void)): void;
    loadResourceAsGltfAsset(resource: DynamicResource, onSuccess: ((glTFAsset: GltfAsset) => void), onFailure: ((errorMessage: string) => void)): void;
    loadResourceAsImageTexture(resource: DynamicResource, onSuccess: ((texture: Texture) => void), onFailure: ((errorMessage: string) => void)): void;
    loadResourceAsVideoTexture(resource: DynamicResource, onSuccess: ((texture: Texture) => void), onFailure: ((errorMessage: string) => void)): void;
}

Hierarchy (view full)

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

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

    Parameters

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

          • errorMessage: string

          Returns void

    Returns void

  • Downloads a remote 3D GLTF file given a DynamicResource.

    Parameters

    • resource: DynamicResource
    • onSuccess: ((glTFAsset: GltfAsset) => void)
        • (glTFAsset): void
        • Parameters

          Returns void

    • onFailure: ((errorMessage: string) => void)
        • (errorMessage): void
        • Parameters

          • errorMessage: string

          Returns void

    Returns void

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

    Parameters

    • resource: DynamicResource
    • onSuccess: ((texture: Texture) => void)
        • (texture): void
        • Parameters

          Returns void

    • onFailure: ((errorMessage: string) => void)
        • (errorMessage): void
        • Parameters

          • errorMessage: string

          Returns void

    Returns void

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

    Parameters

    • resource: DynamicResource
    • onSuccess: ((texture: Texture) => void)
        • (texture): void
        • Parameters

          Returns void

    • onFailure: ((errorMessage: string) => void)
        • (errorMessage): void
        • Parameters

          • errorMessage: string

          Returns void

    Returns void