Skip to main content

Services

Services are pure abstract interfaces looked up through ctx.GetService<T>(). Each has a stable InterfaceId string used as its registry key. This page lists the interfaces shipped with the SDK.

For how to look up and register services, see Cross-Plugin Communication.

Feature services

These are provided by the corresponding feature plugins, so they are present only when that plugin is enabled — always null-check the result of GetService. Declared in <framelift/services.h>.

IHistory

int    GetMostRecent(char* buf, int cap) const noexcept; // most recent path; buf may be null
double GetResumePos(const char* path) const noexcept; // 0.0 if not found

GetMostRecent follows the buffer convention: returns the full length excluding NUL; pass buf=nullptr to query the required size.

History updates (adding entries, updating resume positions) flow through events (FileOpenedEvent / FileEndedEvent) rather than this interface.

Platform services

Registered by the host before any plugin installs, so they are always available in OnInstall. Declared in <framelift/platform.h>.

IMediaPlayer

The playback backend (FFmpeg + libass behind the interface). Commands — LoadFile, SetPause / TogglePause, Seek / SeekAbsolute, ToggleMute, AdjustVolume, SetPlaybackOptions, subtitle/audio track enumeration and selection — plus async property queries (GetDoubleAsync, GetInt64Async, GetStringAsync) and the PollEvent source behind media events. See <framelift/platform/IMediaPlayer.h> for the full surface.

IAppWindow

The application window and its ImGui frame management. See <framelift/platform/IAppWindow.h>.

IDirWatcher

Filesystem change notifications for a watched directory. See <framelift/platform/IDirWatcher.h>.

Other registered services

The host also registers Hotkeys (keybind dispatch — see Keybinds), FocusManager, and ContextMenu, each keyed by its own InterfaceId.

Defining your own

Any plugin can publish a service: a pure abstract class with a unique InterfaceId and POD-only method signatures, registered with ctx.RegisterService<IMyService>(this). See Cross-Plugin Communication and the ABI rules.