lunify.js
Version:
A basic api wrapper for the spotify api covering the oauth routes.
39 lines • 1.08 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlayerDevice = void 0;
class PlayerDevice {
client;
player;
id;
active;
privateSession;
restricted;
name;
type;
volume;
supportsVolume;
constructor(client, player, data) {
this.client = client;
this.player = player;
this.id = data.id;
this.active = data.is_active;
this.privateSession = data.is_private_session;
this.restricted = data.is_restricted;
this.name = data.name;
this.type = data.type;
this.volume = data.volume_percent ?? 100;
this.supportsVolume = data.supports_volume;
}
/**
* Transfer the current playback to this device
* @returns Whenever the refresh was successfull or not
*/
async transferPlaybackTo() {
if (this.active || !this.id)
return false;
await this.player.devices.transferPlaybackTo(this.id);
return true;
}
}
exports.PlayerDevice = PlayerDevice;
//# sourceMappingURL=Device.js.map