Overview
MediaClient is the abstract base class that defines the common interface for all media server implementations (Emby, Plex, FolderServer, Local). All client implementations must extend this class and implement its abstract methods.
In most cases, you should use
ClientFactory to create client instances rather than instantiating clients directly. The factory handles authentication and returns the appropriate client type based on the server configuration.Constructor
Server configuration object containing connection details
Example
Properties
The server configuration passed to the constructor
Abstract Methods
All extending classes must implement these methods:authenticate
Authenticates a user with the media server.Username for authentication
Password or API token for authentication
Returns updated server configuration with authentication token and user ID
getLibraries
Fetches all available media libraries from the server.Array of library objects containing Id, Name, and CollectionType
getVideos
Fetches videos from a library with pagination and filtering.Library ID to fetch from, or undefined for favorites feed
Name of the library for playlist/favorites management
Type of feed: ‘latest’, ‘random’, or ‘favorites’
Number of items to skip for pagination
Maximum number of items to return
Filter by video orientation: ‘vertical’, ‘horizontal’, or ‘both’
Object containing items array, nextStartIndex, and totalCount
getVideoUrl
Generates the streaming URL for a video item.Video item to generate URL for
Streaming URL for the video
getImageUrl
Generates the URL for a video thumbnail or backdrop image.ID of the media item
Image tag/hash for cache busting
Type of image to fetch
URL for the image
getFavorites
Fetches the set of favorited item IDs for a library.Name of the library
Set of item IDs that are favorited
toggleFavorite
Toggles the favorite status of a video item.ID of the item to toggle
Current favorite status (true means currently favorited)
Name of the library for playlist management
Usage with ClientFactory
See Also
- EmbyClient - Emby/Jellyfin implementation
- PlexClient - Plex Media Server implementation
- FolderServerClient - Folder streaming server implementation
- LocalClient - Local file system implementation
- Types - Type definitions