Lens Scripting API

    Class RemoteReferenceAsset

    Provides a reference to a remote asset (i.e. assets outside of the Lens size limit) that can be downloaded at runtime using script.

    //@input Asset.RemoteReferenceAsset myRemoteReferenceAsset
    //@input Component.AudioComponent myAudioComponent

    function onFailed() {
    print("Asset wasn't downloaded from the reference " + script.myRemoteReferenceAsset.name);
    }

    function previewDownloadedAsset(asset) {
    if (asset.isOfType("Asset.AudioTrackAsset")) {
    script.myAudioComponent.audioTrack = asset;
    script.myAudioComponent.play(1);
    } else {
    print("Warning, asset has type " + asset.getTypeName() + ", please set Audio Component input to display");
    }
    }

    script.myRemoteReferenceAsset.downloadAsset(previewDownloadedAsset, onFailed);

    Hierarchy (View Summary, Expand)

    • Asset
      • RemoteReferenceAsset
    Index

    Constructors

    Properties

    name: string

    The name of the Asset in Lens Studio.

    uniqueIdentifier: string

    Methods

    • Request to download the Remote Reference Asset.

      Parameters

      • onDownloaded: (asset: Asset) => void
      • onFailed: () => void

      Returns void

    • 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

    MMNEPVFCICPMFPCPTTAAATR