Overview
EmbyClient extends MediaClient to provide integration with Emby and Jellyfin media servers. It handles authentication, library browsing, video streaming, and playlist-based favorites.
Constructor
Server configuration with Emby server details
Authentication
authenticate
Authenticates with an Emby/Jellyfin server using username and password.Emby username
Emby password
Server URL
Authenticated user’s name
User ID from Emby
Access token for API requests
Always returns ‘emby’
Example
Library Management
getLibraries
Fetches all video libraries available to the authenticated user.Array of library objects
Example
Video Retrieval
getVideos
Fetches videos from a library with advanced filtering and pagination.Library ID to fetch from (undefined for favorites feed)
Name of the library for playlist lookups
'latest': Sorted by DateCreated descending'random': Random shuffle'favorites': Items from Tok playlist
Starting index for pagination
Number of items to fetch (batch size: 50 for latest, 80 for random)
'vertical': Only videos with height >= width * 0.8'horizontal': Only videos with width > height'both': No filtering
Array of video items
Index for the next page of results
Total number of items available
Example
Media URLs
getVideoUrl
Generates direct streaming URL for a video.Video item to stream
Direct MP4 stream URL with authentication token
getImageUrl
Generates URL for video thumbnail or backdrop.Media item ID
Image tag from item.ImageTags
Image type to fetch
Image URL with 800px max width, or empty string if no tag
Example
Favorites Management
EmbyClient uses playlists namedTok-{LibraryName} to store favorites.
getFavorites
Retrieves all favorited item IDs for a library.Name of the library
Set of item IDs in the Tok playlist
toggleFavorite
Adds or removes an item from the favorites playlist.ID of the video item
Current status: true = currently favorited (will remove), false = not favorited (will add)
Library name for playlist lookup/creation
Example
Complete Usage Example
Implementation Details
Headers
All requests include:Content-Type: application/jsonX-Emby-Authorizationwith MediaBrowser client info and token
Orientation Filtering
Videos are filtered based on aspect ratio:- Vertical:
height >= width * 0.8(includes 4:5, 9:16, etc.) - Horizontal:
width > height - Both: No filtering applied
Playlist Creation
Playlists are automatically created when adding the first favorite to a library. Format:Tok-{LibraryName}
See Also
- MediaClient - Base class reference
- PlexClient - Plex implementation
- LocalClient - Local file system implementation
- Types - Type definitions