LensStudio:PushToDevice
ModulePlugin component for pushing lens effects and configurations to physical devices.
Example
// The LensStudio:PushToDevice module provides IPushToDevice (interface) and
// PushToDevice (concrete class) for pushing lenses to physical devices.
//
// IPushToDevice methods:
// isSpectaclesConnected(): boolean — check if Spectacles are paired
// push(pushTypes: PushType[]): Promise — push to the specified targets
//
// PushType enum values:
// PushType.Snapchat — push to Snapchat on a connected phone
// PushType.Spectacles — push to connected Spectacles device
// PushType.CameraKit — push via CameraKit
//
// Obtain IPushToDevice via pluginSystem.findInterface():
// const pushService = pluginSystem.findInterface(IPushToDevice.interfaceId);
const { IPushToDevice, PushType } = await import('LensStudio:PushToDevice');
console.log('IPushToDevice.interfaceId:', IPushToDevice.interfaceId);
console.log('PushType.Snapchat:', PushType.Snapchat);
console.log('PushType.Spectacles:', PushType.Spectacles);
console.log('PushType.CameraKit:', PushType.CameraKit);
// Resolve the push-to-device service from the plugin system
const pushService = this.pluginSystem.findInterface(IPushToDevice.interfaceId) as import('LensStudio:PushToDevice').IPushToDevice;
if (pushService) {
const spectaclesConnected = pushService.isSpectaclesConnected();
console.log('Spectacles connected:', spectaclesConnected);
} else {
console.log('IPushToDevice interface not available in this context.');
}