foo-webview-sdk
    Preparing search index...

    Variable playlistConst

    playlist: {
        add: (
            playlist: PlaylistRef,
            paths: string[],
        ) => Promise<PlaylistAddPathsResponse>;
        addAsync: (
            playlist: PlaylistRef,
            paths: string[],
        ) => Promise<PlaylistAddPathsAsyncResponse>;
        addHandles: (
            playlist: PlaylistRef,
            handles: PlaylistHandleRef[],
        ) => Promise<PlaylistAddHandlesResponse>;
        addSequential: (
            playlist: PlaylistRef,
            paths: string[],
        ) => Promise<PlaylistAddPathsSequentialResponse>;
        clear: (playlist: PlaylistRef) => Promise<PlaylistClearResponse>;
        convertToAutoplaylist: (
            playlist: PlaylistRef,
            query: string,
            sort?: string,
            keepSorted?: boolean,
        ) => Promise<PlaylistConvertToAutoplaylistResponse>;
        create: (
            name: string,
            options?: Omit<PlaylistCreateParams, "name">,
        ) => Promise<PlaylistCreateResponse>;
        createAutoplaylist: (
            name: string,
            query: string,
            sort?: string,
            keepSorted?: boolean,
        ) => Promise<PlaylistCreateAutoplaylistResponse>;
        createManagedAutoplaylist: (
            name: string,
            query: string,
            sort?: string,
            keepSorted?: boolean,
        ) => Promise<PlaylistCreateManagedAutoplaylistResponse>;
        deselectAll: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistDeselectAllResponse>;
        duplicate: (
            playlist: PlaylistRef,
            name?: string,
        ) => Promise<PlaylistDuplicateResponse>;
        focusTrack: (
            playlist: PlaylistRef,
            trackIndex: number,
        ) => Promise<PlaylistFocusTrackResponse>;
        getActive: () => Promise<PlaylistGetActiveResponse>;
        getAll: () => Promise<PlaylistGetAllResponse>;
        getAutoplaylistConfig: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetAutoplaylistConfigResponse>;
        getAutoplaylistInfo: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetAutoplaylistInfoResponse>;
        getAutoplaylistQuery: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetAutoplaylistQueryResponse>;
        getAvailableColumns: () => Promise<PlaylistGetAvailableColumnsResponse>;
        getCount: (playlist: PlaylistRef) => Promise<PlaylistGetTrackCountResponse>;
        getFocused: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetFocusedTrackResponse>;
        getFocusTrack: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetFocusTrackResponse>;
        getGroupRuns: (
            patterns: string[],
            playlist?: PlaylistRef,
        ) => Promise<PlaylistGetGroupRunsResponse>;
        getLockInfo: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetLockInfoResponse>;
        getMatchingRows: (
            query: string,
            playlist?: PlaylistRef,
        ) => Promise<PlaylistGetMatchingRowsResponse>;
        getPlaying: () => Promise<PlaylistGetPlayingResponse>;
        getPlaylistCount: () => Promise<PlaylistGetCountResponse>;
        getSelectedTracks: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetSelectedTracksResponse>;
        getSelection: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistGetSelectionResponse>;
        getTracks: (
            playlist: PlaylistRef,
            start?: number,
            count?: number,
            formats?: Record<string, string>,
            fields?: string[],
        ) => Promise<PlaylistGetTracksResponse>;
        getTracksAt: (
            playlist: PlaylistRef,
            rows: readonly number[],
            formats?: Record<string, string>,
            fields?: string[],
        ) => Promise<PlaylistGetTracksAtResponse>;
        getTracksPage: (
            playlist: PlaylistRef,
            start?: number,
            count?: number,
            formats?: Record<string, string>,
            fields?: string[],
        ) => Promise<PlaylistGetTracksResponse>;
        insertTracks: (
            playlist: PlaylistRef,
            insertIndex: number,
            handles: PlaylistHandleRef[],
            expectedVersion?: string,
        ) => Promise<PlaylistInsertTracksResponse>;
        isAutoplaylist: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistIsAutoplaylistResponse>;
        isLocked: (playlist: PlaylistRef) => Promise<PlaylistIsLockedResponse>;
        moveTracks: (
            playlist: PlaylistRef,
            indices: number[],
            delta: number,
            expectedVersion?: string,
        ) => Promise<PlaylistMoveTracksResponse>;
        onAutoplaylistConfigChanged: (
            callback: (event: PlaylistAutoplaylistConfigChangedPayload) => void,
        ) => () => void;
        onAutoplaylistUIResult: (
            callback: (event: PlaylistAutoplaylistUIResultPayload) => void,
        ) => () => void;
        playTrack: (
            playlist: PlaylistRef,
            trackIndex: number,
            options?: Omit<
                PlaylistPlayTrackParams,
                "index"
                | "playlist"
                | "playlistGuid",
            >,
        ) => Promise<PlaylistPlayTrackResponse>;
        redo: (playlist: PlaylistRef) => Promise<PlaylistRedoResponse>;
        remove: (playlist: PlaylistRef) => Promise<PlaylistRemoveResponse>;
        removeAutoplaylist: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistRemoveAutoplaylistResponse>;
        removeSelectedTracks: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistRemoveSelectedTracksResponse>;
        removeTracks: (
            playlist: PlaylistRef,
            indices: number[],
            expectedVersion?: string,
        ) => Promise<PlaylistRemoveTracksResponse>;
        rename: (
            playlist: PlaylistRef,
            name: string,
        ) => Promise<PlaylistRenameResponse>;
        reorder: (
            playlist: PlaylistRef,
            order: number[],
            expectedVersion?: string,
        ) => Promise<PlaylistReorderResponse>;
        reorderPlaylists: (
            order: readonly string[] | readonly number[],
        ) => Promise<PlaylistReorderPlaylistsResponse>;
        replaceAllAndPlay: (
            options: PlaylistReplaceAllAndPlayParams,
        ) => Promise<PlaylistReplaceAllAndPlayResponse>;
        reverse: (playlist: PlaylistRef) => Promise<PlaylistReverseResponse>;
        selectAll: (playlist: PlaylistRef) => Promise<PlaylistSelectAllResponse>;
        setActive: (playlist: PlaylistRef) => Promise<PlaylistSetActiveResponse>;
        setAutoplaylistConfig: (
            playlist: PlaylistRef,
            options: Omit<
                PlaylistSetAutoplaylistConfigParams,
                "playlist"
                | "playlistGuid",
            >,
        ) => Promise<PlaylistSetAutoplaylistConfigResponse>;
        setFocused: (
            playlist: PlaylistRef,
            trackIndex: number,
            expectedVersion?: string,
        ) => Promise<PlaylistSetFocusedTrackResponse>;
        setSelection: (
            playlist: PlaylistRef,
            indices: number[],
            clearOthers?: boolean,
            expectedVersion?: string,
        ) => Promise<PlaylistSetSelectionResponse>;
        showAutoplaylistUI: (
            playlist: PlaylistRef,
        ) => Promise<PlaylistShowAutoplaylistUIResponse>;
        shuffle: (playlist: PlaylistRef) => Promise<PlaylistShuffleResponse>;
        sort: (
            playlist: PlaylistRef,
            pattern: string,
            descending?: boolean,
            selectedOnly?: boolean,
        ) => Promise<PlaylistSortResponse>;
        undo: (playlist: PlaylistRef) => Promise<PlaylistUndoResponse>;
    } = ...

    playlist — playlist management namespace.

    Methods that take a playlist accept a PlaylistRef: its index, or the guid from getAll, which still names the same playlist after others are added, removed or reordered.

    Type Declaration

    • add: (playlist: PlaylistRef, paths: string[]) => Promise<PlaylistAddPathsResponse>

      Append files, folders or URLs. foobar2000 resolves the batch as its own Add Files does, so the rows do not keep the given order; use playlist.addSequential for that. Entries over 2048 characters and entries that resolve to nothing are counted in invalidCount; when nothing is added the call fails with NOT_FOUND.

    • addAsync: (
          playlist: PlaylistRef,
          paths: string[],
      ) => Promise<PlaylistAddPathsAsyncResponse>

      Start adding paths without waiting; playlist:addComplete with the returned operationId reports the outcome. Empty entries and entries over 2048 characters are counted in invalidCount.

    • addHandles: (
          playlist: PlaylistRef,
          handles: PlaylistHandleRef[],
      ) => Promise<PlaylistAddHandlesResponse>

      Append tracks by path or { path, subsong }. Unusable entries are counted in invalidCount; when none is usable the call fails with NOT_FOUND.

    • addSequential: (
          playlist: PlaylistRef,
          paths: string[],
      ) => Promise<PlaylistAddPathsSequentialResponse>

      Append paths in the given order and report the row of each added track. Entries over 2048 characters and entries that resolve to nothing are skipped.

    • clear: (playlist: PlaylistRef) => Promise<PlaylistClearResponse>

      Remove every track from a playlist, saving an undo point first.

    • convertToAutoplaylist: (
          playlist: PlaylistRef,
          query: string,
          sort?: string,
          keepSorted?: boolean,
      ) => Promise<PlaylistConvertToAutoplaylistResponse>

      Turn an existing playlist into an autoplaylist; its tracks are replaced by the query results.

    • create: (
          name: string,
          options?: Omit<PlaylistCreateParams, "name">,
      ) => Promise<PlaylistCreateResponse>

      Create an empty playlist with the given name and options.

    • createAutoplaylist: (
          name: string,
          query: string,
          sort?: string,
          keepSorted?: boolean,
      ) => Promise<PlaylistCreateAutoplaylistResponse>

      Create a playlist that foobar2000 fills from a library query and keeps up to date.

    • createManagedAutoplaylist: (
          name: string,
          query: string,
          sort?: string,
          keepSorted?: boolean,
      ) => Promise<PlaylistCreateManagedAutoplaylistResponse>

      Create an autoplaylist with editable query and sorting rules. It requires this component to remain installed. Success returns the configuration, without waiting for track rebuilding or disk persistence.

    • deselectAll: (playlist: PlaylistRef) => Promise<PlaylistDeselectAllResponse>

      Deselect all tracks in a playlist.

    • duplicate: (playlist: PlaylistRef, name?: string) => Promise<PlaylistDuplicateResponse>

      name omitted or empty, the copy is named after the original with (Copy) appended.

    • focusTrack: (
          playlist: PlaylistRef,
          trackIndex: number,
      ) => Promise<PlaylistFocusTrackResponse>

      Use playlist.setFocused.

    • getActive: () => Promise<PlaylistGetActiveResponse>

      Resolve with found: false and no other fields when there is no active playlist.

    • getAll: () => Promise<PlaylistGetAllResponse>

      Every playlist in playlist order, in playlists.

    • getAutoplaylistConfig: (playlist: PlaylistRef) => Promise<PlaylistGetAutoplaylistConfigResponse>

      Read this component's managed autoplaylist configuration and revision. Other providers return a failure envelope. Use configAvailability from getAutoplaylistInfo to decide whether to offer a configuration form.

    • getAutoplaylistInfo: (playlist: PlaylistRef) => Promise<PlaylistGetAutoplaylistInfoResponse>

      Inspect autoplaylist state and editor availability without opening UI. unknown means the provider has no capability probe. source: 'sdk' includes third-party clients; source: 'dui' identifies an Auto-named lock, not a UI mode. That lock's keepSorted: false is an unreadable setting's placeholder, not its actual value. configAvailability separately reports structured configuration support.

    • getAutoplaylistQuery: (playlist: PlaylistRef) => Promise<PlaylistGetAutoplaylistQueryResponse>

      Read autoplaylist state with its query and sort. Both are read live from foobar2000's built-in query/sort client and are null for any other provider, a list managed by this component (use getAutoplaylistConfig), or a configuration that cannot be parsed; note says which. Test query before sort, which older hosts omit. Editor capability is available from getAutoplaylistInfo. The same provider-source and unreadable keepSorted rules apply here.

    • getAvailableColumns: () => Promise<PlaylistGetAvailableColumnsResponse>

      The Default UI playlist columns, in columns.

    • getCount: (playlist: PlaylistRef) => Promise<PlaylistGetTrackCountResponse>

      Number of tracks in playlist, sent as the host's playlist.getTrackCount; the envelope carries it in count. Resolves with count 0 when the playlist does not exist. The number of playlists is playlist.getPlaylistCount, which is what the host's playlist.getCount returns.

    • getFocused: (playlist: PlaylistRef) => Promise<PlaylistGetFocusedTrackResponse>

      index is -1 when the playlist has no focus or does not exist.

    • getFocusTrack: (playlist: PlaylistRef) => Promise<PlaylistGetFocusTrackResponse>

      Use playlist.getFocused.

    • getGroupRuns: (
          patterns: string[],
          playlist?: PlaylistRef,
      ) => Promise<PlaylistGetGroupRunsResponse>

      Group a whole playlist into consecutive runs and get back only the run boundaries, never the rows.

      A run is a maximal stretch of adjacent tracks whose group key is equal, compared case-insensitively over ASCII A-Z/a-z. Rows are never reordered, so runs follow playlist order. Pass one Title Formatting pattern, or two to sub-group within each run.

      Pair it with playlist.getTracks to drive a grouped virtual list: the runs give header positions and total scroll height, each visible page of rows is fetched separately.

      A pattern that groups every row on its own makes runs as long as total. Payload size also depends on key lengths and second-level runs. There is no cap; choose patterns that combine adjacent tracks.

      Malformed patterns, or a pattern that fails to compile, resolves with { success: false, code: 'INVALID_PARAMS' }; for an empty pattern or one that fails to compile, details.pattern carries its index. An index past the last playlist resolves with INVALID_INDEX.

    • getLockInfo: (playlist: PlaylistRef) => Promise<PlaylistGetLockInfoResponse>

      Describe a playlist's lock status, lock name, and what the lock forbids.

    • getMatchingRows: (
          query: string,
          playlist?: PlaylistRef,
      ) => Promise<PlaylistGetMatchingRowsResponse>

      The rows of a playlist whose tracks match a foobar2000 query, as { playlist, playlistGuid, total, items, count } with items ascending; one call however long the playlist is. Read the rows with playlist.getTracksAt.

      A query the parser rejects, or one carrying SORT BY, resolves with { success: false, code: 'INVALID_PARAMS', details: { param: 'query' } }; the error text is in the host's language. A lowercase letter matches either case in the tag, an uppercase one only the same case. The answer is a snapshot: drop it on playlist:itemsAdded, itemsRemoved, itemsReordered, itemsReplaced and metadb:changed. A query that depends on the time (DURING LAST) also drifts with no event.

    • getPlaying: () => Promise<PlaylistGetPlayingResponse>

      Resolve with found: false and no other fields when nothing is playing.

    • getPlaylistCount: () => Promise<PlaylistGetCountResponse>

      Number of playlists, sent as the host's playlist.getCount; the envelope carries it in count. For the number of tracks in one playlist use playlist.getCount.

    • getSelectedTracks: (playlist: PlaylistRef) => Promise<PlaylistGetSelectedTracksResponse>

      The selected tracks of a playlist, as { playlist, count, tracks }. Rows are whole PlaylistTracks without the play statistics. An empty selection succeeds with an empty tracks; a playlist that does not exist resolves with a failure envelope.

    • getSelection: (playlist: PlaylistRef) => Promise<PlaylistGetSelectionResponse>

      Report the 0-based indices of all selected tracks in a playlist.

    • getTracks: (
          playlist: PlaylistRef,
          start?: number,
          count?: number,
          formats?: Record<string, string>,
          fields?: string[],
      ) => Promise<PlaylistGetTracksResponse>

      Fetch a slice of tracks from a playlist, as the page { playlist, start, count, total, tracks }.

      Without fields each row is a whole PlaylistTrack, with the play statistics foo_playcount provides. fields narrows every row to the requested keys plus index, out of the same case-sensitive list library.query takes, which is why rows are typed as PlaylistTrackPartial. formats maps column names to Title Formatting patterns; each row carries their values under formats. An unknown field name resolves with { success: false, code: 'INVALID_PARAMS' }.

      Compare total with playlist.getGroupRuns's total for the same playlist to detect a change in track count between the reads. Equal totals do not rule out replacements or reordering: the calls return independent snapshots, not a shared playlist revision.

    • getTracksAt: (
          playlist: PlaylistRef,
          rows: readonly number[],
          formats?: Record<string, string>,
          fields?: string[],
      ) => Promise<PlaylistGetTracksAtResponse>

      Rows of a playlist picked by row number, as { playlist, total, count, tracks }, the rows in the order given. Rows past the last one are skipped and every row carries its index, so match rows by index rather than by position in tracks. formats and fields work as in playlist.getTracks; a playlist that does not exist answers an empty result, as there.

    • getTracksPage: (
          playlist: PlaylistRef,
          start?: number,
          count?: number,
          formats?: Record<string, string>,
          fields?: string[],
      ) => Promise<PlaylistGetTracksResponse>

      Use playlist.getTracks, which resolves with the same page.

    • insertTracks: (
          playlist: PlaylistRef,
          insertIndex: number,
          handles: PlaylistHandleRef[],
          expectedVersion?: string,
      ) => Promise<PlaylistInsertTracksResponse>

      Insert tracks before row insertIndex; past the last row, they are appended.

    • isAutoplaylist: (playlist: PlaylistRef) => Promise<PlaylistIsAutoplaylistResponse>

      Report whether a playlist is an autoplaylist or carries an automatic-playlist lock.

    • isLocked: (playlist: PlaylistRef) => Promise<PlaylistIsLockedResponse>

      Report whether a playlist carries a lock (e.g. from an autoplaylist).

    • moveTracks: (
          playlist: PlaylistRef,
          indices: number[],
          delta: number,
          expectedVersion?: string,
      ) => Promise<PlaylistMoveTracksResponse>

      Replace the selection with indices, then move the selection by delta rows; the caller's own selection is lost. An empty indices moves the current selection.

    • onAutoplaylistConfigChanged: (
          callback: (event: PlaylistAutoplaylistConfigChangedPayload) => void,
      ) => () => void

      Observe managed configuration changes from all component windows. Re-read the snapshot before editing; this does not signal completion of track rebuilding or disk persistence. Returns an unsubscribe function.

    • onAutoplaylistUIResult: (callback: (event: PlaylistAutoplaylistUIResultPayload) => void) => () => void

      Subscribe to native editor call results for this calling document. Subscribe before showAutoplaylistUI and retain early events by operationId in a bounded buffer until acceptance is handled. Success only means the native call returned normally, not that an editor opened, closed or saved changes. Results are not forwarded after navigation. Returns the unsubscribe function; call it when the consumer is disposed.

    • playTrack: (
          playlist: PlaylistRef,
          trackIndex: number,
          options?: Omit<
              PlaylistPlayTrackParams,
              "index"
              | "playlist"
              | "playlistGuid",
          >,
      ) => Promise<PlaylistPlayTrackResponse>

      Start playing the track at the specified index in a playlist.

    • redo: (playlist: PlaylistRef) => Promise<PlaylistRedoResponse>

      Fails with NOT_FOUND when there is nothing to redo.

    • remove: (playlist: PlaylistRef) => Promise<PlaylistRemoveResponse>

      Delete a playlist.

    • removeAutoplaylist: (playlist: PlaylistRef) => Promise<PlaylistRemoveAutoplaylistResponse>

      Release an autoplaylist-manager client, keeping the current tracks.

    • removeSelectedTracks: (playlist: PlaylistRef) => Promise<PlaylistRemoveSelectedTracksResponse>

      Remove all selected tracks from a playlist, saving an undo point first.

    • removeTracks: (
          playlist: PlaylistRef,
          indices: number[],
          expectedVersion?: string,
      ) => Promise<PlaylistRemoveTracksResponse>

      Remove rows; rows past the last one are ignored.

    • rename: (playlist: PlaylistRef, name: string) => Promise<PlaylistRenameResponse>

      Rename a playlist.

    • reorder: (
          playlist: PlaylistRef,
          order: number[],
          expectedVersion?: string,
      ) => Promise<PlaylistReorderResponse>

      order[i] is the current row of the track that moves to row i.

    • reorderPlaylists: (
          order: readonly string[] | readonly number[],
      ) => Promise<PlaylistReorderPlaylistsResponse>

      Reorder the playlist list. order[i] names the playlist that moves to position i, every playlist exactly once: all current indices, sent as newOrder, or all guids from playlist.getAll, sent as newOrderGuids. Indices are read as the call arrives, so an order built from an earlier getAll silently moves the wrong playlists once another one was added and removed in between; GUIDs keep naming the playlists they were read from and fail with NOT_FOUND for one that is gone.

    • replaceAllAndPlay: (
          options: PlaylistReplaceAllAndPlayParams,
      ) => Promise<PlaylistReplaceAllAndPlayResponse>

      Stop, clear, add the paths in the given order, activate the playlist and play or focus playIndex, counted in that order. When nothing could be added the call fails with NOT_FOUND and the playlist stays empty.

    • reverse: (playlist: PlaylistRef) => Promise<PlaylistReverseResponse>

      Reverse track order in a playlist, saving an undo point first.

    • selectAll: (playlist: PlaylistRef) => Promise<PlaylistSelectAllResponse>

      Select all tracks in a playlist.

    • setActive: (playlist: PlaylistRef) => Promise<PlaylistSetActiveResponse>

      Make a playlist the active one.

    • setAutoplaylistConfig: (
          playlist: PlaylistRef,
          options: Omit<
              PlaylistSetAutoplaylistConfigParams,
              "playlist"
              | "playlistGuid",
          >,
      ) => Promise<PlaylistSetAutoplaylistConfigResponse>

      Edit rules using the revision from a recent configuration snapshot. Omitted fields stay unchanged; an empty sort clears it and false disables keep-sorted. Host failures can leave partial changes: inspect the failure envelope and re-read before retrying. A revision is not a track version.

    • setFocused: (
          playlist: PlaylistRef,
          trackIndex: number,
          expectedVersion?: string,
      ) => Promise<PlaylistSetFocusedTrackResponse>

      A negative trackIndex removes the focus.

    • setSelection: (
          playlist: PlaylistRef,
          indices: number[],
          clearOthers?: boolean,
          expectedVersion?: string,
      ) => Promise<PlaylistSetSelectionResponse>

      Rows past the last one are ignored; a negative row fails with INVALID_PARAMS.

    • showAutoplaylistUI: (playlist: PlaylistRef) => Promise<PlaylistShowAutoplaylistUIResponse>

      Request the native editor for an explicitly named autoplaylist. A numeric index selects the playlist at that position when first handled by the host; subsequent work follows its GUID. Pass a GUID to preserve identity before that first lookup. Does not activate the playlist or play.

      Resolves with acceptance or a business failure envelope, without waiting for the native call to return or the editor to close. Subscribe with onAutoplaylistUIResult before calling: a result can arrive before this promise is handled. Match it by operationId; it does not report saving or cancellation. Navigation or destruction discards result delivery.

    • shuffle: (playlist: PlaylistRef) => Promise<PlaylistShuffleResponse>

      Randomly shuffle tracks in a playlist, saving an undo point first.

    • sort: (
          playlist: PlaylistRef,
          pattern: string,
          descending?: boolean,
          selectedOnly?: boolean,
      ) => Promise<PlaylistSortResponse>

      descending reverses the whole playlist after sorting, the unselected tracks too when selectedOnly is set.

    • undo: (playlist: PlaylistRef) => Promise<PlaylistUndoResponse>

      Fails with NOT_FOUND when there is nothing to undo.