I've been digging around the Emby and Jellyfin source code. Some of what I found out is documented in the comments.