Player
Status: works on both engines, phone and TV. As of 2026-11-29. Trickplay previews: the player part of #860 is done; the original report (no previews on ExoPlayer on one phone) was never reproduced.
Start here
Section titled “Start here”- The player is one
PlayerViewModelinplayer/local(phone and TV share it). The engine is behindPlayerEngineinengine/:engine/exo/ExoEngine.ktandengine/mpv/MpvEngine.kt. Both give a media3Player, so shared code never names an engine (rule R6). - The queue is
PlayQueue, a service inapplicationsince step 17 of #970: what is queued, which item plays, previous and next, the next season, shuffle and where the first item starts. It hands out items;PlaylistManagermakes thePlayerItemof each, and the local player and Cast both go through it. How an item is asked for isResolvePlayback(a use case inapplicationsince step 15 of #970: it reads the settings throughPlayerSettingsand gives aResolvedStream, whichPlaylistManager.toPlayerItemturns into thePlayerItem), quality and transcode-audio switches areStreamSwitches(a service inapplicationsince step 18 of #970, which also stores a quality pick for the network in use and decides when an item asked for on the other network has the queue asked for again), which tracks play and what a pick by hand is remembered as isTrackPreferences, and the audio a transcode is asked for isTranscodeAudio(both services inapplicationsince step 16 of #970: see subtitles-and-tracks.md), trickplay isTrickplayLoader(phone) andTrickplayRegionLoader(TV). - Reports to the server are
PlaybackReporter(a service inapplicationsince step 13 of #970; the view model hands it eachPlayerItemas aReportedStream,presentation/ReportedStreams.kt) andPlaybackStartGate: see playback-reporting.md. Resume position and played: user-data.md. Tracks and subtitles: subtitles-and-tracks.md. - Test fast:
./gradlew :player:local:testDebugUnitTest, and./gradlew :domain:testfor the rules indomain/.../playback/rule/(segments, up next, still watching, the sleep timer, the end of an item, the start gate, the reported pause, autoplay, the stop report, the series tracks). Player PRs also run docs/mpv-checklist.md on both backends, with the adb steps and the report of theplayer-verifyskill (.claude/skills/player-verify/SKILL.md). - Trickplay (#860): the loaders are built with the played version (
PlayerItem.mediaSourceId) and ask for that version’s sheets; a sheet that failed is left alone for 30 s (TrickplaySheetFailures), andTrickplayLoadersamples a sheet larger thanMAX_SHEET_PIXELSdown instead of running out of memory. onMediaItemTransitioninPlayerViewModel.kttakes the item before it waits for the previous item’s stop, and hands it with itsItemTransitiontoPlaybackReporter.onTransitionHandled, which drops it when a switch came meanwhile (#890).- What plays now (#1016): the phone’s quality dialog has a line such as “Converted by the server · 720p · up to 4 Mbps”.
NowPlaying.ofdecides it from thePlayerItem(isTranscoded,streamCap,sourceBitrate,transcodeBitrate) and the decoded video size (player.videoSize: ExoPlayer’s, mpv’swidth/height), read byPlayerViewModel.nowPlaying(); the dialog reads it again every second.
What it does
Section titled “What it does”ExoPlayer is the default engine, mpv the other (AppPreferences.playerBackend, which PlayerViewModel reads through PlayerSettings.backend, #969); EngineModule binds both. PlayQueue builds the queue of a movie or an episode series, PlaylistManager turns its items into PlayerItems, and NeighbourLoader adds the neighbours to the player’s playlist once the item is ready. ResolvePlayback asks the server how to play (direct, a transcode under the chosen cap, or a finished download). A version, quality or audio switch asks for the whole queue again and swaps it in (StreamSwitches, rebuildQueue; the latest switch wins, #726). PlaybackService keeps the media session; with background audio on, PlaybackSessionStore keeps the view model alive without the activity. NetworkRecovery waits for the network when a stream breaks (#450); DisplayRefreshRateManager votes for a refresh rate (#338).
Where the code is
Section titled “Where the code is”Paths are under player/local/src/main/java/dev/jdtech/jellyfin/player/local/ unless they start with app/, server/ or another module.
| Path | What |
|---|---|
| presentation/PlayerViewModel.kt | The player: initializePlayer, onMediaItemTransition, onPlaybackStateChanged, onPlayerError, the switches, getTrickplay / getTvTrickplay, releasePlayer. Very large: search by name |
| engine/PlayerEngine.kt, EngineDefaults.kt | PlayerEngine, EnginePlayer (transitionsOnReplacedPlaylist, onItemReady, setZoomMode), the shared defaults |
| engine/exo/ | ExoEngine, MediaSourceFactory, AudioDecoderFallback, TunnelingFallback, TunneledFrameRateRenderer, subtitle sources. ExoPlayer keeps its default frame rate strategy |
| engine/mpv/ | MpvEngine, MPVPlayer (media3 BasePlayer over libmpv), and one small file per mpv rule: MpvCallQueue, MpvStallWatch, MpvLoadState (whether an END_FILE is a failed load), MpvStreamBreak, MpvErrorRecovery, MpvItemTransitions, SelectedVideoFrameRate, and MpvDeviceRules (a setting that is broken on some devices and what plays instead, #1073) |
| application/…/PlayQueue.kt | The queue (step 17 of #970): start (a movie, an episode, a season, a series from next up, a shuffle; the first item’s sources asked for next to it, a QueueStart), loadQueue, previous/next with the next season, jumpTo, again, forget, setCurrent, upcomingItems, and startPositionMs, where the player starts. Each operation takes the conversion of the caller; an item counts as handed out once it succeeded, and is not handed out again until it is forgotten or a jump starts over |
| domain/PlaylistManager.kt | The queue as the player’s items: getInitialItem, getNextPlayerItem, jumpTo, recreatePlayerItem call PlayQueue with toPlayerItem, which resolves the stream and reads the trickplay layout of the played source. Cast takes it too (CastPlayerControllerImpl, FakeCast) |
| application/…/ResolvePlayback.kt, ResolvedStream.kt | resolve (one request and the pick), sources (TranscodeAudio asks it again for the audio of a transcode): the playback target, engine and cap (#766), the cap per network (#837, qualityNetwork, storeMaxBitrate). Settings through PlayerSettings (maxBitrate(network), preferredAudioLanguage), no AppPreferences. player/local provides it in di/ResolvePlaybackModule.kt, with the phone or TV choice of the cap per network |
| application/…/TrackPreferences.kt, TranscodeAudio.kt | Which tracks play (onTracks: the reset alone or with the picks, now or once the series’ choice is read), what a pick by hand is remembered as, and the audio index a transcode is asked for. The view model builds its TrackPreferences with its own scope; PlaylistManager builds its TranscodeAudio. Details in subtitles-and-tracks.md |
| domain/NowPlaying.kt | The quality dialog’s line (#1016): original, converted or download, the resolution name of the decoded size, the bitrate. The dialog is QualitySelectionDialogFragment.kt |
| application/…/StreamSwitches.kt, QueueRebuild.kt | The switches (step 18 of #970): selectBitrate (stored for the network in use, undone in that network’s setting when it fails), selectAudio, itemPlays (#837), rebuildQueue. Generic over the player’s item: the view model’s Host makes each PlayerItem (PlaylistManager.recreatePlayerItem) and reloads the player (swapInQueue). The toast’s text is switchFailureText in domain/SwitchFailureText.kt. Cast’s audio switch does not use it (see cast.md) |
| domain/TrickplayLoader.kt, TrickplayRegionLoader.kt, TrickplayTiles.kt | Sheet loads (sheetLoad, decodeSheet, tileAt), the TV region loader, the tile arithmetic; TrickplaySheetFailures.kt: how long a failed sheet is left alone |
| domain/ | NeighbourLoader, segmentTrackerFrom (builds a SegmentTracker from the settings), NetworkRecovery, isNewEndOfItem (#477, EndOfItem.kt), DisplayRefreshRateManager, DebugSegments. No media3 here (R27) |
| mapping/ | media3’s values to ours and back (since step 18 of #970): isNewEndOfItemReport (EndOfItem.kt, which reads the reason and state for domain/EndOfItem.kt’s rule of #477), the track names (Extensions.kt), TrackChoices and TrackKind.trackType (TrackPicks.kt), SubtitleFiles.kt, and NETWORK_ERROR_CODES (PlaybackErrors.kt), which the view model hands NetworkRecovery |
| domain/…/playback/rule/ | The player’s pure rules, in domain since step 9 of ADR 0003: UpNextCountdown, SegmentTracker (Cast applies the same rule through CastSegmentSkipper, #851), SleepTimer, StillWatchingTracker, PlaybackStartGate, ReportedPause; since step 10 AutoPlayNext (over the AutoPlayNextSetting that PlayerSettings returns), PlaybackStopReport and the series track matching; and EndOfItemSteps (step 11), the order at the end of an item (the sleep timer first, then a cancelled card, the autoplay wait and still watching; the card and the outro skip). Since step 12 PlayerViewModel calls its steps (onPlayWhenReadyChanged, advanceOrAskStillWatching, updateUpNext, autoSkip, acknowledgeStillWatching, continueAfterSleepTimerEnd) and only carries out what each returns. Their tests run in :domain:test |
| PlaybackService.kt, PlaybackSessionStore.kt | The media session service; the owner of the view model for the phone player |
| presentation/PlayerMediaSessions.kt, PlayerTexts.kt, PlayerDevice.kt | What PlayerViewModel (and Cast’s, for the debug segments) asks Android for instead of taking a Context (#969, R23): the media session and PlaybackService, the track and message texts, the debug flag, density, files and fake segments. Its settings come through PlayerSettings, StillWatchingSettings and MediaSegmentSettings |
| PlayerActivity.kt | The phone player screen (Views); PreviewScrubListener.kt shows the seek preview; dialogs in presentation/player/ |
| TV ce/presentation/player/ | TvPlayerScreen, TvPlayerKeyHandler, TvTrickplayThumbnail, TvSeekBar, TvUpNextCard, TvResumeOnReturn (ADR 0004) |
| http/…/MediaHttpClient.kt | The API’s own OkHttp client, provided by server/jellyfin. ExoPlayer streams media over it (MediaSourceFactory derives its client with newBuilder(), so media shares the API’s connection pool, #296); mpv uses it only for subtitle files, and libmpv fetches the media itself, with its own TLS. A module of its own so domain names no library (#964) |
| JellyfinDeviceProfiles.kt, device/…/CodecHelpers.kt | The device profile that decides direct play or transcode: ExoPlayer gets the one built from the probed decoders (DeviceCodecProbe, CodecHelpers maps their profiles and levels), mpv the permissive one. About → Export device profile shows both |
| JellyfinPlayback.kt | trickplayTile and trickplayVersion (the mediaSourceId of a tile request) |
| PlaybackInfoMappers.kt | toItemTrickplayInfo, preferredTrickplayInfo: the width the player gets |
| PlaybackMedia.kt | getTrickplayData(itemId, width, sheetIndex, mediaSourceId) |
| player/core/…/models/ | PlayerItem, Trickplay, TrickplayInfo |
- R6:
engine/exoandengine/mpvuse neither each other, and shared code uses neither; onlyengine.dibinds both. A feature of one engine goes behindEnginePlayer. - R1, R2, R3: no Jellyfin SDK in the player. The adapter maps SDK types.
- R10: ids are
ItemIdandMediaSourceId; noUUID, noStringid in a signature. - R27: no file of
player/localoutsideengine,mapping,presentationanddinames media3 (PlayerRulesMedia3Test). A rule takes our own types; the view model ormappingturns media3’s values into them. The media session’s service (PlaybackService.kt, named in the manifest) is listed inarchitecture/baseline/player-media3.txt. R27 checks names, not use: a rule could still use a media3 type amappingfunction returns without naming it, so keepmappingto mappers. - R24:
PlayerViewModel,CastPlayerControllerImplandCastViewModelmay not grow past their line ceilings inarchitecture/size-ceilings.txt(ADR 0003). Move a rule out instead of adding to them. - R12: ticks only through
Ticks. R5, R19:domainandapplicationstay pure Kotlin, with no library but kotlinx; an OkHttp type goes throughhttp, not a port. - Player PRs: docs/mpv-checklist.md on both backends. Do not fix mpv by touching the ExoPlayer path.
PlayerInvariantsTestfails the build when ExoPlayer loses its default frame rate strategy, when mpv stops hinting the surface with the frame rate (#338), and for other mpv invariants (no calls on the main thread, a network timeout, replaced playlists reported). It also fails whenPlayerViewModeldecides the end of an item itself (readssleepTimer.stopsAtEndOfItem,upNextCountdown.isCancelled,stillWatchingTracker.onAutoAdvance, …) instead of callingEndOfItemSteps: a change to that order goes in the rule and a row ofEndOfItemStepsTest.- New strings:
translate-stringsskill, all 36 languages.
How to test it
Section titled “How to test it”Unit tests, no device:
./gradlew :player:local:testDebugUnitTest./gradlew :domain:test # the rules in domain/.../playback/rule/./gradlew :application:test --tests '*ResolvePlayback*' --tests '*TrackPreferences*' --tests '*TranscodeAudio*' --tests '*PlayQueue*' --tests '*StreamSwitches*' --tests '*RebuildQueue*'./gradlew :server:jellyfin:testDebugUnitTest --tests '*Trickplay*' --tests '*PlaybackSourceMappingTest'./gradlew :architecture:testUseful classes: PlayerInvariantsTest, AudioDecoderFallbackTest, TunnelingFallbackTest, StreamSwitchesTest and RebuildQueueTest (in application), QueueRebuildTest (the rebuild with the neighbour lookup), ResolvePlaybackTest, TrackPreferencesTest and TranscodeAudioTest (in application), PlaylistManagerResolvedStreamTest (what the queue asks for and carries), ResolvePlaybackModuleTest, PlayQueueTest, PlayQueueNextSeasonTest, PlayQueueShuffleTest and PlayQueueNextUpTest (in application), PlaylistManagerQueueTest (the player’s part: start positions, a stream that fails), NeighbourLoaderTest, TrickplayTilesTest, TrickplayLoaderTest, TrickplaySheetFailuresTest, NetworkRecoveryTest, PlaybackStartGateTest, MpvItemTransitionsTest, MpvStartPositionsTest, MpvStallWatchTest, MpvDeviceRulesTest, NowPlayingTest, PlaylistManagerStreamBitrateTest, PlaylistManagerFrameRateTest, TunneledFrameRateTest. In the adapter: TrickplayTileRequestTest, TrickplaySheetTimeoutTest, TrickplayWidthTest, TranscodeBitrateTest.
On a device, on the test server (docs/dev-environment.md, test-server and test-devices skills):
- Plain Movie, Short Movie (ends at once), Long Movie, Resume Show (4 episodes, resume positions).
- Versions Movie: two versions (360p, 720p), for version and trickplay questions (#860).
- Hevc Movie, Hdr Ten Movie for decoders; Av1 Movie, Av1 Ten Movie (8-bit and 10-bit AV1) for the AV1 conditions of the device profile; Level Six Movie, Hevc Level Six Movie (level 6.0) for the level cap: on ExoPlayer they transcode when the decoder’s level is below 6.0 (
videoCodecLevelsin About → Export device profile under 60 for H.264, 180 for HEVC; the emulators stop at 5.2) and direct-play when it reaches it; on mpv the level never stops direct play (a quality cap below the file’s bitrate still transcodes, as for any file). - Quality switch: a cap below the file’s bitrate. q837 Low, Mid and High Movie are 1080p at about 1.2, 5 and 12 Mbps (#837, #1016): (H.264 and AAC, so the cap alone decides) a cap above a file plays the original, below it the server transcodes and picks the size itself (High at 4 Mbps is 1280x720, at 8 Mbps 1920x1080, at 720 kbps 960x540; the newest
FFmpeg.Transcode-*.login the container’s/config/logsays what it sends). The clips last a minute, and the player closes at the end. Slow link: emulator at 3G (#860). A held request (#890): see playback-reporting.md. - A real device for refresh rate, HDR and Dolby Vision. mpv needs software rendering on an emulator. Mute first.
docs/mpv-checklist.md is the list: resume, from 0, seek, media session, refresh rate vote (dumpsys SurfaceFlinger), back out; plus playlist, autoplay, quality switch and slow link when the PR touches them. The player-verify skill has the test item, the commands and the pass condition for each, and its scripts/pv.sh opens the player on an item from adb (adb root, then am start of PlayerActivity with the item id in UUID form), switches the backend, and reads the states, reports, media session and vote back.
Before a PR
Section titled “Before a PR”./gradlew ktfmtCheck./gradlew :architecture:test./gradlew :player:local:testDebugUnitTest :server:jellyfin:testDebugUnitTest./gradlew :app:phone:compileLibreDebugKotlin :app:tv:compileLibreDebugKotlinAdd :app:phone:compileProprietaryDebugKotlin when Cast code or the player/core models change. Then the mpv checklist on both backends. When no review bot ran, a player PR gets an independent review (CLAUDE.md).
Decisions and history
Section titled “Decisions and history”- #126, #134: the TV player on the shared view model (ADR 0004).
- #267, #284, #305: a faster start left mpv in
BUFFERING; the reason the checklist exists. - #338: the refresh rate vote, pinned by
PlayerInvariantsTest. #450: wait for the network, then reload; the callback comes fromNetworkSignalsindevicesince #998 (R28). - #657: neighbours load when the item is ready. #723, #726: switches on mpv; the latest switch wins. #837: a default quality per network. #1016: the quality dialog says what plays now; options that change nothing stay (a pick is saved as the network’s default), and no height limit is sent (it would force transcodes and touch the device profile). The TV player has no quality picker.
- #764, #765, #766:
PlayerEngine,PlaybackReporterandResolvePlaybackout ofPlayerViewModel. Proposed next: ADR 0003 (#970), the rest of the flows (the end of an item, the track choice, the queue, the switches) as rules indomainand services inapplication, one per PR, shared with Cast. #870 / #889: mpv reports a replaced playlist itself. - #1073: the first device rule for mpv, copy-back decoding on the Pixel 11 family, taken from Findroid
20bf6f536. Findroid’s table also turnsaaudiointoaudiotrackon Samsung; Ephyra’s audio output isaudiotrackon every device already (#52), so that rule was not taken. The rule and the read ofBuildare inengine/mpv, not behind a port in thedevicemodule: only mpv asks, the answer is two constants, and the rule is tested by passing them in. - #860 / #878: the adapter sends the version, compares widths as numbers and gives sheets 30 s. The player part: the played version in the tile request, no new try of a failed sheet for 30 s, sheets sampled down above 3200x5760 pixels (every 320-wide 10x10 sheet up to portrait 9:16 stays whole) and an out-of-memory error caught. The width choice of #878 compares the sheet’s width (at most 3200) before its pixels, so 4:3 and portrait items keep width 320 over 160; 16:9 items on a square grid get the same width as before.
Pitfalls
Section titled “Pitfalls”- Trickplay previews that do not show (#860). A sheet that failed is not asked for again for 30 s, also when the server is back: scrub again after that before calling it a bug. To stage a failing or slow sheet, put a proxy that answers
/Trickplay/with an error between the emulator and the server and log in through it; the request carriesmediaSourceIdonly for a version other than the item’s own (the adapter leaves it out otherwise). Tiles of a sheet sampled down come out smaller (half size above 3200x5760, such as a 10x10 sheet of 640 wide). The test server only has 16:9 sheets at 320: a 4:3 or portrait case is in the unit tests (TrickplayLoaderTest,TrickplayWidthTest), not on the server. - A switch during a stop (#890).
onMediaItemTransitionfindsiteminitems, waits for the previous item’s stop, then callsonTransitionHandled(item, ..., transition); a switch that lands in that wait makesitemstale, and the reporter drops it by the transition’s number. Details: playback-reporting.md. Both backends. - A quality switch is a new playlist. ExoPlayer reports a transition to the same item; mpv reports none (
transitionsOnReplacedPlaylist). Code keyed on transitions must handle both (#870). - mpv keeps an entry’s start option on Previous (#1146). A resume, quality switch or retry can load a playlist entry with
start=. mpv uses that option again when Previous reopens the entry.MpvStartPositionsremembers it per media item, so the first playback restart seeks to the requested position (0 on Previous) when it differs from where mpv opened. Keep the option after that restart: consuming it once makes the next visit start at the old resume or switch position. Inserting a neighbour must not move this association. Check both a resumed item and an item reloaded by a quality switch: Next, then Previous twice must return it to 0; paused stays paused. If mpv rejects that corrective seek and sends no second playback restart,MpvSeekCompletionreports an error after the existing stall give-up interval, also while paused. A completed restart, new load or playback error cancels that wait; ordinary resume and quality-switch seeks keep their existing handling. After a corrective-seek timeout, Retry opens the same media item at 0 without changing the position reported for the failed playback. It finds that item again in the current playlist, so inserting or removing earlier neighbours cannot send its retry target to another entry; a removed target is not retried. Stop discards both the corrective target and its numeric recovery record; ordinary error recovery keeps its existing stop behavior. An explicit seek while errored overrides that retry target. A same-item seek while the correction is still pending replaces its deadline and retry target; ordinary seeks do not acquire a correction deadline. Moving to another item while an initial resume is still loading drops that pending resume: the destination uses its own requested position, or 0 by default. - A move to another item keeps the pause (#1121). On both engines, Next and Previous leave
playWhenReadyas it was, as media3 does: paused stays paused. mpv used to callplay()inseekTofor another item. Code that should play after the move callsplay()itself (autoAdvanceToNextItem,playUpNextNow); so does a tap in the queue, which replaces the playlist (jumpToQueued) and plays. - Find an item by id, not by index. Indexes shift when neighbours load (#869).
- The queue hands out each neighbour once (#657).
PlayQueue.previousandnextreturn null for an item it handed out already, also when the caller lost it. A caller that drops a neighbour callsforget, a jump starts over withjumpTo, and Cast keeps the answers it got inCastPlaylistOrder. A newPlayQueue(a newPlaylistManager) for every new thing the user starts, or the next playlist gets no neighbours. - Cancelled queue lookups propagate (#1141).
PlayQueuerethrowsCancellationExceptionbefore handling other failures, including neighbour conversion and the next-season lookup. Cancellation writes no error log and leaves the item available for a later lookup.PlayQueueTestcovers both neighbours and the next season. - Queued downloads stay on disk (#1143).
PlayerViewModelpublishes the local files of its resolved playlist throughPlaybackEvents.queuedDownloadIds, usingPlayerItem.streamCap == nullas the existing download marker. Smart Downloads protects these files even after the player moves to Previous. The playlist retains earlier items so the user can return to them. Published local files stay protected until player release, even across a jump or a failed replacement: assignment of the new list does not mean the engine has relinquished the old one. A later Smart Downloads check can remove them after release. - mpv can stand on its last frame without
eof-reached(#1116). Play from a paused seek to the very end (a paused outro skip on the last item) and mpv stays at the last frame and reports nothing. The stall watch treats standing still withinMpvStallWatch.END_TOLERANCE_MSof the duration as the end and callsonEndOfFile(), the same path aseof-reached, so the item ends a few seconds after Play (6.5 s on the emulator:STALL_MSof standing still, counted from the first check after the seek). - mpv is not called on the main thread after init (
MpvCallQueue), and its state can drift from media3’s: read the log, not the picture (checklist). - A failed load on mpv is decided in
MpvLoadState(#446, #576, #786). libmpv callseventEndFile(reason, error)just beforeevent(MPV_EVENT_END_FILE), andMPVPlayerposts both on one handler, so the reason is there when the END_FILE branch runs (PlayerInvariantsTestpins it). An end with a reason other thanERROR(a redirect, EOF, a stop) is no failure; one withERRORkeeps mpv’s error code (mpv could not open the file: … (mpv error -13)in the log). Error lines can still come after END_FILE (the hold); on the test server’s Broken Movie, “Failed to recognize file format” arrives after the report, soMPV_ERROR_UNKNOWN_FORMAT(-17) is what makes itERROR_CODE_PARSING_CONTAINER_UNSUPPORTED. A refused connection (ffmpeg: tcp:) and a connection failure while reading the HTTP response (ffmpeg: http:/ffmpeg: https:, #996) are classified by their error lines, since mpv reports them as a plain loading failure (-13), while an HTTP status from the server (HTTP error 404) keeps its plain error. To stage a redirect (reasonREDIRECT), answer the stream URL with an m3u playlist that points back at it. - The refresh rate vote differs per engine: ExoPlayer keeps its default strategy, mpv hints the surface itself. An mpv change that loses the hint passes every other test (#338).
- A codec without a profile mapping is direct-played at any profile (#1029).
generateCodecProfileadds theVIDEO_PROFILEcondition only when the probe found profiles, so a codec thatCodecHelpersdoes not map (AV1 until #1029) went to ExoPlayer whatever the stream. The server names AV1 8-bit and 10-bit bothMain, so AV1 is held by aVIDEO_BIT_DEPTHcap from the decoder’s profiles (AV1_PROFILE_BIT_DEPTHS). - Levels are capped per codec, and only for H.264, HEVC and AV1 (#1061). Until #1061 the probe read the levels and dropped them, so the server direct-played a stream above every decoder’s level; ExoPlayer logs
Format exceeds selected codec's capabilitiesand tries anyway. Now each codec gets aVIDEO_LEVELLESS_THAN_EQUALcondition with the highest level any of its decoders advertises in any profile (ProbedCodecs.videoCodecLevels; also in the device report asvideoCodecLevels). Per codec, not per profile: a decoder lists the highest level for each profile, these are nearly always the same, and one limit per codec needs no apply conditions on the server’s profile names. The numbers are the server’s: H.264level_idc(5.1 is 51), HEVC 30 times the level (5.1 is 153), AV1seq_level_idx(5.1 is 13). Other codecs get no level, because the server has none for them or counts the other way (MPEG-2). A Dolby Vision decoder counts as HEVC but its levels do not: they are Dolby Vision levels, held bydolbyVisionProfiles. The condition is not required, so a stream without a known level is not held back by it (the other conditions still apply). The cap also holds in the HLS transcode: the server copies H.264 into the segments when it can, so H.264 gets atscodec profile with only the level (the profile names would also choose the profile of the server’s own encode); without it the server sent a level 6.0 file to a transcode for its level (the reason VideoLevelNotSupported) and then copied the video as it was. - A platform audio decoder that fails mid-stream is dropped for ffmpeg (
AudioDecoderFallback), per OS build. - Tunneling refuses some audio formats (#924).
EngineDefaultsasks ExoPlayer for tunneling, and a tunneled AudioTrack needs the device’s HW A/V sync output, which may not take every channel mask (the Xiaomi TV box: no mono). The track then fails to open (ERROR_CODE_AUDIO_TRACK_INIT_FAILED,getOutputForAttr() return error -38);TunnelingFallbackturns tunneling off and the player prepares again at the same position, once per item (Tunneling failed to open an audio track, retrying without tunneling). It comes back on when another media id plays (Tunneling back on for the next item), not after a switch on the same item. Emulators do not tunnel: only a TV device shows it. - Tunneled, ExoPlayer votes only with the format’s frame rate (#1024). ExoPlayer’s vote comes from its frame rate estimator, which starts at the video
Format.frameRateand learns the real rate from the frames it releases; tunneled, the codec renders the frames and the estimator never sees one.MatroskaExtractorsets no frame rate, so a tunneled mkv sent no vote (SIDEBANDlayer, empty “Frame Rate (Explicit)”).TunneledFrameRateRendererfills in the server’s rate of the video stream (PlayerItem.videoFrameRate, theMediaItem’sServerFrameRatetag; a direct stream only) when the stream is tunneled and the format has no rate. The log lineVideo stream: tunneling=…, format frame rate=[…], server's=…says what it had. Without tunneling nothing changes; a download has no server rate. The track formats keep no rate, soDisplayRefreshRateManagerstill sees none for an mkv. - A proxy that asks for a client certificate (#960). mpv reads https through FFmpeg on mbedTLS, and FFmpeg’s
tls_mbedtls.cconfigured an own certificate and key also when none was given, empty. A server that asks for a client certificate, also one that only asks (Caddyclient_authmodeverify_if_given), then broke the handshake:ffmpeg: tls: TLS handshake failed.(TLS 1.3) ormbedtls_ssl_handshake returned -0x3e80(TLS 1.2;-0x6600with mbedTLS 3.6.6). Seen in every release from 2.5.0 up to libmpv 1.3.0; ExoPlayer is not affected. libmpv 1.4.0 patches FFmpeg to register a certificate only when one was loaded (midasvo/libmpv-android#56); the app has no workaround of its own. The same lines have other causes too (any failed handshake, such as no common TLS 1.3 group), so they alone do not prove the patch is gone: if mpv fails on the site that asks for a certificate and plays on the same site withoutclient_auth, check whether a libmpv bump dropped the patch. Stage it withtools/test-server/caddy-tls.sh(dev-environment.md): port 8443 asks for a certificate, 8444 is the same site withoutclient_auth. - A quality option is only a bitrate cap (#1016). The cap alone never makes the server convert a file under it, and above it the server picks the resolution; a file under the cap can still be converted for another reason (a codec the device profile does not take), and the line then says “Converted by the server”. The dialog’s line says which: the size is the one decoded, never the label’s. For a transcode the bitrate is a limit (“up to”): the least of the cap and the
VideoBitrate+AudioBitrateof the server’s transcoding URL, left out when it is not below the file’s own bitrate (a transcode for the codec alone carries a limit of 1 Gbps). A download says “Playing the download”, not “the original”: a download made at a download quality cap is a transcode too, and the model does not say which. mpv logsmpv_get_property(width) … property unavailablewhen the size is asked for before a file is loaded; that is no failure. - The hardware decoding setting is not always what mpv gets (#1073).
MpvDeviceRulesreplaces a mode that is known to be broken on a device: on the Pixel 11 family (Build.MANUFACTURERGoogle,Build.MODELPixel 11, Pixel 11 Pro, Pixel 11 Pro XL, Pixel 11 Pro Fold)mediacodecbecomesmediacodec-copy, because switching the subtitle track froze playback for good there (Findroid20bf6f536, seen on a Pixel 11 Pro with the Android 17 DP11 beta; not reproduced here, nobody has the device). Settings → Player → mpv options still showsmediacodec: the setting is not rewritten, so the rule can be removed without leaving a changed setting behind.noandmediacodec-copyare passed as chosen, andhwdec=in mpv.conf overrides what the app passes, also on these devices. A debug build logs when a rule applied (mpv: hwdec 'mediacodec' is known to be broken on Google Pixel 11 Pro, using 'mediacodec-copy'), once per player. That line is in debug builds only: it is logged at info level, the phone’s release build plants no log tree and the TV’s keeps warnings and up (BaseApplicationof each app), so its absence in a release build’s log says nothing.MpvEnginereadsBuildand hands it to the rule, which is plain Kotlin (MpvDeviceRulesTest). On a release build the app has no way to show which mode plays: nothing reads mpv’shwdec-current, there is no stats overlay, and the device report under About does not have the mpv settings. What is left is logcat over adb: FFmpeg printsh264_mediacodec: Both surface and native_window are NULLwhen it opens a decoder for copy-back and nothing formediacodec, and that line comes from libmpv’s own logging (tagmpv), not from the app’s log tree; it was seen on a debug build only, not checked on a release build. Test again on stable Android 17 and remove the rule when the freeze is gone. - Emulators: host GPU rendering crashes mpv; on Android 17 images ExoPlayer cannot decode H.264 (
docs/dev-environment.md).
Source: docs/areas/player.md · raw Markdown