Skip to main content

LensStudio:AssetLibrary.MusicListService

Class

Service interface for submitting and managing music list requests.

Index

Example

// Resolve IAssetLibraryProvider to access the MusicListService.
const provider = this.pluginSystem.findInterface(
IAssetLibraryProvider.interfaceId
) as IAssetLibraryProvider;
if (Editor.isNull(provider)) {
console.log('IAssetLibraryProvider not available');
return;
}

const musicService = provider.musicService;
console.log('MusicListService obtained from provider');

// Build a request with environment settings and a search filter
const envSetting = new EnvironmentSetting();
envSetting.environment = Environment.Production;
envSetting.space = Space.Public;

const filter = new AssetFilter();
filter.searchText = 'chill';

const request = new AssetListRequest(envSetting, filter);
const response = await musicService.fetchAsync(request);
if (response.ok) {
console.log('Music fetch succeeded');
} else {
console.log('Music fetch failed or cancelled:', response.cancelled);
}

Extends

Methods

fetchAsync()

fetchAsync(request): Promise<MusicListResponse>

Fetches a list of music assets matching the given request and returns a promise resolving to a MusicListResponse.

Parameters

ParameterType
requestAssetListRequest

Returns

Promise<MusicListResponse>


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame