@42techpacks/expo-spotify-sdk
Version:
Expo Module for native Spotify SDK
88 lines • 4.52 kB
TypeScript
import { Subscription } from "expo-modules-core";
import { SpotifyConfig, SpotifySession, AuthorizeAndPlayURIResult, PlaybackResult, SkipTrackResult, AppRemoteConnectionConfig, AppRemoteConnectionResult, AppRemoteDisconnectionResult, AppRemoteConnectionFailureEvent, AppRemoteDisconnectedEvent, AppRemoteConnectedEvent, PlayerStateResult, PlayerStateSubscriptionResult, PlayerStateChangedEvent, AddToQueueConfig, AddToQueueResult } from "./ExpoSpotifySDK.types";
declare function isAvailable(): boolean;
declare function authenticateAsync(config: SpotifyConfig): Promise<SpotifySession>;
/**
* Authorizes with Spotify and immediately starts playback of the provided URI
* @param uri The Spotify URI to play
* @returns Promise that resolves with a success boolean
*/
declare function authorizeAndPlayURIAsync(uri: string): Promise<AuthorizeAndPlayURIResult>;
declare function isAppRemoteConnected(): boolean;
declare function connectAppRemoteAsync(config: AppRemoteConnectionConfig): Promise<AppRemoteConnectionResult>;
declare function disconnectAppRemoteAsync(): Promise<AppRemoteDisconnectionResult>;
/**
* Starts or resumes playback on the active device
* @returns Promise that resolves with a success boolean
*/
declare function playAsync(): Promise<PlaybackResult>;
/**
* Plays a specific track by URI
* @param uri The Spotify URI of the track to play
* @returns Promise that resolves with a success boolean
*/
declare function playTrackAsync(uri: string): Promise<PlaybackResult>;
/**
* Pauses playback on the active device
* @returns Promise that resolves with a success boolean
*/
declare function pauseAsync(): Promise<PlaybackResult>;
/**
* Gets the current player state
* @returns Promise that resolves with the current player state
*/
declare function getPlayerStateAsync(): Promise<PlayerStateResult>;
/**
* Subscribes to player state changes
* @returns Promise that resolves with a success boolean
*/
declare function subscribeToPlayerStateAsync(): Promise<PlayerStateSubscriptionResult>;
/**
* Unsubscribes from player state changes
* @returns Promise that resolves with a success boolean
*/
declare function unsubscribeFromPlayerStateAsync(): Promise<PlayerStateSubscriptionResult>;
/**
* Skips to the next track in the current context
* @returns Promise that resolves with a success boolean
*/
declare function skipToNextAsync(): Promise<SkipTrackResult>;
/**
* Skips to the previous track in the current context
* @returns Promise that resolves with a success boolean
*/
declare function skipToPreviousAsync(): Promise<SkipTrackResult>;
/**
* Adds a track to the playback queue
* @param config Object containing the Spotify URI to add to the queue
* @returns Promise that resolves with a success boolean
*/
declare function addToQueueAsync(config: AddToQueueConfig): Promise<AddToQueueResult>;
declare function addAppRemoteConnectedListener(listener: (event: AppRemoteConnectedEvent) => void): Subscription;
declare function addAppRemoteConnectionFailureListener(listener: (event: AppRemoteConnectionFailureEvent) => void): Subscription;
declare function addAppRemoteDisconnectedListener(listener: (event: AppRemoteDisconnectedEvent) => void): Subscription;
declare function addPlayerStateChangedListener(listener: (event: PlayerStateChangedEvent) => void): Subscription;
declare const Authenticate: {
authenticateAsync: typeof authenticateAsync;
};
declare const AppRemote: {
authorizeAndPlayURIAsync: typeof authorizeAndPlayURIAsync;
isAppRemoteConnected: typeof isAppRemoteConnected;
playAsync: typeof playAsync;
playTrackAsync: typeof playTrackAsync;
pauseAsync: typeof pauseAsync;
skipToNextAsync: typeof skipToNextAsync;
skipToPreviousAsync: typeof skipToPreviousAsync;
addToQueueAsync: typeof addToQueueAsync;
connectAppRemoteAsync: typeof connectAppRemoteAsync;
disconnectAppRemoteAsync: typeof disconnectAppRemoteAsync;
addAppRemoteConnectedListener: typeof addAppRemoteConnectedListener;
addAppRemoteConnectionFailureListener: typeof addAppRemoteConnectionFailureListener;
addAppRemoteDisconnectedListener: typeof addAppRemoteDisconnectedListener;
getPlayerStateAsync: typeof getPlayerStateAsync;
subscribeToPlayerStateAsync: typeof subscribeToPlayerStateAsync;
unsubscribeFromPlayerStateAsync: typeof unsubscribeFromPlayerStateAsync;
addPlayerStateChangedListener: typeof addPlayerStateChangedListener;
};
export { isAvailable, Authenticate, AppRemote };
//# sourceMappingURL=index.d.ts.map