Repository navigation
Add trailer playback from movie and show detail - #92
Conversation
873c463 to
ffb1d18
Compare
|
Tested 1. Original trailer playback builds a malformed URLThe trailer returned by PMS has a
The device log shows the resulting failure: With fixed Relevant code: The query builder should preserve an existing query string and append new parameters with 2. Show trailers are labelled
|
There was a problem hiding this comment.
Thanks for working on this — trailers are something I've wanted to add for a long time too 🙌
I had a slightly different UX in mind, though. Rather than copying the standalone Trailer button from the original Plex app, I was thinking more along the lines of autoplaying the trailer in the Hero area instead of the static Hero image, like most of the big streaming apps do these days.
Another option would be an Extras section on the detail page, where trailers and the other extras are shown as preview tiles. That would make the trailer feel like part of the item's additional content instead of a one-off action.
I'm not strongly attached to one of those two options yet, but I'd like us to settle that direction before locking in the button-only approach. Together with the two playback issues in my comment above, I'm requesting changes for now.
That's a good idea, I like that UX that it loads and plays the trailer automatically and then having the extra/alternative trailers in the detailed view. I'll update this PR to address your findings and implement that UI/UX for the trailers. |
Signed-off-by: Marco Rojas <[email protected]>
Signed-off-by: Marco Rojas <[email protected]>
…ras handling Signed-off-by: Marco Rojas <[email protected]>
ec85c5a to
2a227a9
Compare
A leftover pub(super) static ACTIVE: () = (); sat before the file's //! module doc comment, which rustc rejects (E0753: inner doc comments must be the first item in the file). This broke every CI job that compiles the crate: host checks, the armv7 cross-build, and both desktop simulators. The static was unused (ACTIVE is not referenced anywhere in this module).
fa38e77 to
9fe9fe6
Compare
…refuse to Load under a k5lp jail with no /dev/rtkmem (issue plxnative#74) Reported on an LG 43UM7400PLB (Realtek k5lp, webOS 4.10.0) running v0.6.0: every playback died the instant it started. The user's local crash log is a SIGSEGV in libc (r0=0) right after `SMP loadCompleted (priming before Play)`; the Sentry event PLX-NATIVE-E from a later attempt is a SIGABRT on the firmware's OMX_VideoComp thread with the app's main thread inside StarfishMediaAPIs::Play (pump.rs:1096) and the app's load thread STILL inside Load (gst_dvo_context_start -> DirectVoInit -> DirectVoRelease), both parked in pthread_mutex_lock. Neither log has a `SMP: Load returned` line before the death. Two findings, kept apart on purpose. 1. Proven from the code: src/starfish.c set SMP_READY(1) BEFORE calling the real, synchronous g_load_with_context(), and every main-thread verb dispatched through sf_ready_object() on that flag alone. So isLoadCompleted, Play, Feed and the ACB bind were all free to run while Load was executing on the load thread — the pump's loadCompleted arm was even triggered by its own concurrent isLoadCompleted poll. The dev set (m16p3) has the identical ordering and survived because nothing was buffered to feed inside the window; the reporter's HLS transcode had full queues. Measured with this fix on the dev set: Load was still in flight 176-874 ms after loadCompleted on every route. 2. Community-tier, merged upstream: the reporter installed through Developer Mode, whose jail on k5lp/k3lp lacks /dev/rtkmem (webosbrew/webos-homebrew-channel#202), which crashes or hangs every A/V homebrew app on that chassis (Kodi's wiki excludes k5lp; moonlight-tv#243). Load hanging inside video-output init fits that. Nothing off a desk can prove it for this set. The fix, at the shared mechanism rather than per call: - src/starfish.c: a release-ordered `g_load_returned` flag (plain __atomic builtins, no locks), cleared before the real Load call and set after it returns; sf_ready_object() now requires it beside SMP_READY(). sf_ready() keeps meaning "an object exists". Cleared at every SMP_SET_READY(0) site. The acb_* verbs still dispatch on g_acb alone and are bounded only by the pump's stage machine; the comment above acb_create says so rather than letting "every verb" be read as true of them. - player/shared.rs: NativeSessionPhase::Active gains an epoch-scoped `load_call` (InFlight | Returned, with timestamps), so a superseded session's late thread cannot open a new session's gate; threads.rs publishes Returned right after sf_load and before the route ticket. - player/pump.rs: the loadCompleted arm requires the load thread's return BEFORE polling isLoadCompleted, logging once per session `native: loadCompleted while Load in flight — deferring` and `native: Load returned after <N>ms`. NATIVE_LOAD_BUDGET (20 s) bounds both halves — Load not returning, and loadCompleted never arriving after it did — and routes through the existing load_failed / failure read-out arm instead of a permanent spinner. place_exported moves behind the same gate (a correction: ss4s places the window after Load returns). - webos.rs + player/mod.rs: once per boot, before the first Load, read /etc/prefs/properties/machineName and on k5lp/k3lp probe access("/dev/rtkmem", R_OK); log `devjail: soc=<name> rtkmem=ok|missing|n/a` beside the `webos:` line. When missing, the Load is never attempted and the failure read-out gets a `jail` variant naming what was found and the remedy (the Homebrew Channel's jailer fix). `/tmp/plxnative-failtest=jail` reaches it headlessly. - dev trigger `plxnative-holdload[=ms]` (not DIAG): sleeps the load thread after sf_load returns and before the flag publishes, so the deferral, the budget expiry and the read-out are observable on a real set. - release.yml gains a `line` input so a patch can be cut from a release/vX.Y branch (the resulting version must be X.Y.N, N >= 1, matching the branch; trunk still must end in .0), the completed audit is pushed back to that line, and build.rs reads a tracked RELEASE_LINE marker to report next-patch-dev (0.6.1-dev) on a maintenance line while trunk stays byte-identical. - Telemetry, so the next case of this shape is findable from the dashboards: FailureKind::LoadTimeout (`load_timeout`) for the budget expiry, distinct from a refused Load; a `LoadGateOpened` trace breadcrumb carrying the in-flight time as a bucket class (under_1s / 1_to_5s / 5_to_20s / over_20s), never a number; and two closed-enum fields on every opt-in report — Sentry's `hardware` context and the PostHog usage properties — `rtkmem` (ok / missing / n/a) and `install` (devmode / homebrew / unknown, from the app-dir prefix, never the path). A completeness test ties every FailureKind code to the documented `playback.failed` domain, which PRIVACY.md also lists. The C helper `plx_sentry_set_webos_context` grew the two parameters on both sides; fw-compat review passed. - Prose the change falsified is corrected: threads.rs ("Load returns quickly"), ffi.rs ("sf_ready() keeps that safe"), agent-reference.md's RELEASE=1 and failtest paragraphs, bump-version.py's docstring, the cut-release skill. Tests, red first (AGENTS.md): hostsim-only `load_in_flight_tests` in engine.rs — a real two-thread run holding the fake sf_load open after loadCompleted asserts ZERO seam dispatches while in flight (v0.6.0: `left: 51, right: 0`, the first offender being the isLoadCompleted poll), plus the positive half that playback proceeds once Load returns; `the_gate_is_epoch_scoped` (a narrow simulation, not a historical reproduction); both budget-expiry arms; the jail refusal's reachability and its retirement off-route; the pure machine-name predicate; the RELEASE_LINE derivation. make check: 2112 default / 2141 hostsim, 0 failed; --no-default-features clean; tools/fwcompat.py OK on 4.4.2 through 11.2.0; ci/check-elf.sh clean, DT_NEEDED unchanged. Device (dev set m16p3, debug install, panel off): pipe_h264_ac3_1080p, pipe_abr_steady_modest_link, pipe_seek_inplace, transcode_av1_no_dp_audio and seek_transcode all PASS, every log reading `deferring` -> `SMP: Load returned` -> loadCompleted -> Play/prime -> first feed -> ACB bound. What the dev set cannot show is the crash itself: only the reporter's k5lp can, and a verification build that stops at the deferral line and reaches the budget instead of `Load returned` means the gate is correct but the jail is the answer. (cherry picked from commit ac30526)
…cal merge reminders Added important notes in both SKILL.md files regarding the necessity of merging patches back into after they land on a release branch. Highlighted a specific incident where a fix was not merged, leading to a misdiagnosed crash. Emphasized the importance of checking and the project's git history before decompiling to avoid redundant efforts. These updates aim to improve the workflow and prevent future issues related to unmerged fixes. Signed-off-by: Marco Rojas <[email protected]>
…clearing Added a new function to clear the framebuffer to transparent black, allowing for proper blending over the hardware video plane. Updated to utilize an alpha parameter for more flexible color clearing. Adjusted to conditionally use based on the presence of a preview picture, enhancing visual fidelity during playback. Also updated related documentation to reflect these changes in the rendering process. Signed-off-by: Marco Rojas <[email protected]>
|
Btw, I have a design system in Claude Design, along with mockups for all the screens, but I don’t think I can share them on a personal plan. |
|
@GLinnik21 How about we wrap up the changes here as an initial simplified version, and you can follow up later with the designs you have? At this point, it gets the trailers and autoplays them in the background from the detailed view. I also added a |
…d improve session handling Modified the load_in_flight_tests to utilize the PlayerAdapter for managing playback sessions, enhancing the test structure. Updated the cleanup process to reset player control with the current playback session state. This change aims to improve the reliability of tests related to load handling and session management. Signed-off-by: Marco Rojas <[email protected]>
…for accurate episode identification Added a new field `is_real_episode` to the `NowPlaying` struct to differentiate between genuine episodes and extras like trailers. Updated related functions and tests to ensure correct handling of this new field, improving the accuracy of the player HUD display for episodes and trailers. Signed-off-by: Marco Rojas <[email protected]>
…ve playback state management Updated the `project_extras` function to ensure the winner is always prioritized in the extras list, even when the maximum limit is reached. Modified the `HeldFeature` struct to use an `Option` for the return state, allowing for better handling of item-menu initiated plays. Refactored the `halt_preview` function to separate concerns and improve clarity. Adjusted related functions to maintain consistent behavior across playback requests and item actions. Signed-off-by: Marco Rojas <[email protected]>
|
I have a few more changes in progress for the UI style for the title logo and the interactions when focusing on the trailer, I will push those changes in a few hours. |
…imizations - Introduced a new `TODOS.md` file outlining tasks for enhancing player and trailer preview functionality, including legibility grading, RSS headroom re-measurement, and device verification passes. - Updated `docs/trailer-ux-plan.md` with a comprehensive design plan for faster autoplay, logo shrinking, and maintaining synopsis visibility during background playback. - Adjusted `DWELL_S` constant from 4.5s to 2.0s to improve responsiveness in autoplay scenarios. - Enhanced `DetailScreen` and related modules to support new UI behaviors in full-trailer mode, ensuring only the Play/Resume button remains focusable. - Added tests to validate the new focus behavior and ensure the integrity of the trailer UX features. This commit lays the groundwork for a more engaging user experience during trailer playback, addressing both performance and visual clarity. Signed-off-by: Marco Rojas <[email protected]>
GLinnik21
left a comment
There was a problem hiding this comment.
Wow, this is super cool! I really appreciate the animations. I have two minor suggestions:
- Perhaps “Extras” should be placed under “Cast & Crew.”
- Maybe the trailer should play only once instead of looping.
…back issues - Introduced a latched flag `nopreview_armed` to control background trailer autoplay, improving user experience during media playback. - Updated the `enabled` function to utilize the new flag for better management of autoplay behavior. - Added a timeout note in the `after_pump` function to highlight potential issues with native load thread handling. - Enhanced `DetailScreen` to manage trailer playback more effectively, ensuring correct resolution and cache handling for trailers. These changes aim to refine the trailer playback experience and address existing playback management concerns. Signed-off-by: Marco Rojas <[email protected]>
There was a problem hiding this comment.
Maybe better move it to docs
Agree, I'll change the order and prevent the looping. What do you think about the play button staying visible even in fullscreen play? Right now it fades out but it's focused when you go fullscreen so if press "enter" it play the media. |
Signed-off-by: Marco Rojas <[email protected]>
Oh, that wasn’t obvious to me. I accidentally pressed Up and only then realized that it hides the UI. So yeah, having Enter activate a hidden button doesn’t seem like good UX. In that state, I’d expect the controls to affect the trailer playback instead. |
…trailer scrim - Move Extras below Cast & Crew in the detail page's section order (sections()), verified safe against the identity-keyed LayoutCache (not the array-position hazard a prior learning flagged, already retired in 2a227a9). - Suppress trailer auto-replay per visit: preview_played_for/preview_started_for track the item whose trailer already finished, reset on WillLeave/Unmount. Natural completion is detected via preview_completed_naturally (extracted as a pure function so it's testable without the live player::preview singleton), gated on preview_promoted || hero_active so a trailer that finishes inside full-trailer mode is caught, not just the sitting-still case. - Wire the bottom hero scrim (detail_layout::base_scrim_a) to fade out entering full-trailer mode and back in on exit via a new preview_base_scrim eased scalar; it was previously unwired from full-trailer state entirely. - Extract hero_active (hero && !scrolled_off) to remove duplicated boolean logic across the abandon trigger, can_dwell, and the new completion check. - Add regression coverage: section-reorder pixel-identity test, play-once natural-completion/abandon/leave-reset cases, and the deferred Machine-level just_finished flag as a TODO (not implemented here). See docs/trailer-ux-plan.md §8 for the full design and review record.
980ce8d to
e50016c
Compare
- Eliminated the `thread_local!` declaration for `ACTIVE` in `browse.rs` as it was not utilized in the code, streamlining the module and improving clarity.
…n BACK Full-trailer mode (UP-promoted) drew the whole hero action row through preview_chrome, which eases to zero along with everything else — but hero::visible_ctls already collapses the row down to just Play/Resume in that mode, which was meant to stay at full strength. draw_hero now paints the button row through the unscaled hero-scroll alpha instead of chrome whenever full_trailer() is active, so Play/Resume no longer fades out. BACK also gained a middle stage: pressing it while a trailer is autoplaying in the background (picture up, not yet promoted) now stops the preview and lets preview_tick animate the logo, ratings and title back to their resting position, staying on the page. A second BACK press, with nothing left to collapse, falls through to the existing ContentReq::Back exit — so BACK now unwinds full-trailer -> background preview -> leave, one stage at a time. Adds a regression test pinning that plain BACK navigation is unaffected when no preview is active.
GLinnik21
left a comment
There was a problem hiding this comment.
I think we can merge this now — there’s already a lot of good work here and I’d rather not keep extending the PR.
One thing I’d like to revisit separately: after trying the latest version, keeping the main Play button visible by itself in fullscreen trailer mode looks a bit odd to me. I think the better long-term behavior would be to hide the detail-page actions completely and have Up/Enter show the trailer playback HUD instead.
I’ll track that as a follow-up rather than blocking this PR on it.
Merges #92 (trailer playback from detail), #89 (sequential media GETs reuse the HTTP/1.1 demux socket), #94 (Windows WSLg/Linux simulator support), the landing-page site/ tree and other unrelated origin/main work into this branch's own commit (13316a8, "fix: scrub bare host= key/value hostnames from logs"), resolving each conflicted file by preserving both sides' intent: - rust-modules/src/player/ffi.rs, mod.rs, pump.rs, threads.rs, webos.rs, src/starfish.c, rust-modules/src/app/playback.rs: kept both branches' independent additions (resolved in earlier sessions on this branch). - rust-modules/src/player/shared.rs: kept both sides' distinct `LoadCall` enum members; git's auto-merge had silently produced a duplicate enum definition with no conflict markers, caught only by compiling. - rust-modules/src/player/engine.rs: removed a duplicate `load_in_flight_tests` module that auto-merge combined from both sides without markers. - rust-modules/src/plex/session.rs: wired `trailer_autoplay` (our side) into `CanonicalSessionPreferences`, `split_public()` and `join_canonical()` (origin/main's refactor of the same struct), which the auto-merge had left half-connected. - rust-modules/src/screens/registry.rs: recombined the `SCREEN_SHAPES_PIN` changelog (already merged cleanly as text) and bumped the pin constant to the merged tree's real hash (0xb462_145d_9477_05de -> 0x0e66_311c_e4f1_0769), documenting the bump as the union of independent changes rather than one feature. Two more fixes were required for the merged tree to pass verification at all, both confirmed to be pre-existing defects already present on origin/main's own fetched tip (227d981) rather than anything this merge produced: - ci/check-deps.sh: restored the missing closing brace on `strip_strings_and_comments()` (a bash syntax error on origin/main's tip that broke `make check`). - ci/allow/sibling-migration.txt: replaced literal, unresolved stash-conflict markers baked into origin/main's own committed content with this branch's already-clean, closed-out version (count 0, matching a dangling repair commit b58db338 that fixed the same file identically but was never merged into origin/main). One further fallout fix, found only by the fourth verification command and unrelated to origin/main (the file does not exist there at all): rust-modules/src/webos/jail_repair.rs's `expect(dead_code)` condition on `Failure::Timeout` incorrectly required `devtriggers` to be off; hostsim's `call_hbc` stub never constructs that variant outside tests regardless of `devtriggers`, so `cargo check --features hostsim` (as opposed to `cargo test`, which compiles the test module that uses it) failed. Narrowed the condition to `hostsim` + `not test`. Verification, all green: - make check: full host suite + make lint + ci/check-deps.sh + all package/dependency gates pass (exit 0). - CARGO_INCREMENTAL=0 cargo +nightly check --no-default-features: passes. - cargo +nightly check --features hostsim: passes (after the jail_repair.rs fix above). - make (ARM cross-build, FLAVOR=debug): passes, produces pkg/plxnative and pkg/plxnative-storage. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W3rkPgGB7xpjGgcPbfakaF
#92's trailer_autoplay contract is "absence is on", but two spots in the canonical/split-storage session read path (introduced by the v0.7 forward-port merge, 8f42586) contradicted it: - CanonicalSessionPreferences derived Default, giving trailer_autoplay: false via the plain bool default. join_canonical and public_session both fall back to .unwrap_or_default() when public.preferences isn't a JSON object (null, absent, or corrupt) -- and a struct field's `#[serde(default = "default_true", ...)]` only fires for a missing KEY inside an object being deserialized, never for this whole-value fallback. Fixed with a manual `impl Default for CanonicalSessionPreferences` that sets trailer_autoplay: true (the other fields keep the same "absence" values the derive already gave them). - public_session (the Locked/protected-bundle snapshot constructor) never read trailer_autoplay out of the parsed preferences at all, falling through `..Default::default()` on Session -- so a session opened while Keymanager is locked always reported the hero trailer off regardless of what was actually stored. Fixed by threading `trailer_autoplay: preferences.trailer_autoplay` into its Session literal, matching every other public preference field it already threads through. Test-first: added join_canonical_with_null_preferences_keeps_trailer_autoplay_on, public_session_with_null_preferences_keeps_trailer_autoplay_on (both observed red against the unfixed tree -- "assertion failed: session.trailer_autoplay()" -- before this fix), plus paired explicit-false cases for both functions (already green, kept as regression coverage). Grepped the rest of the canonical/public storage path for the same drop-a-field pattern; join_canonical already threaded every field explicitly and split_public/split_canonical (the write path) were already correct, so public_session's omission was the only other instance. Verified: make check (host suite + lint, green) and CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-features (green). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W3rkPgGB7xpjGgcPbfakaF
Official movie and show pages offer trailers. Ours had Related and Cast and never asked PMS for extras, so there was no disc, no menu row, and no clip to play.
What this PR changes
Movie and show detail fetch
GET /library/metadata/{rk}/extrasin parallel with/related. Serial depth stays 2 / 5; a refused extras GET does not fail the page. Episode and season pages do not pay that hop and do not inherit the show trailer.The picker keeps one playable trailer (
subtype == "trailer"orextraType == 1, with a non-emptyPart.key), preferringprimaryExtraKey, else first in server order. A primary that names a non-trailer, or a trailer with no Part, is ignored. At most one follow-upmetadata()fills a missing Part; never N+1 over the rest of the list.When that extra is playable, the hero grows a Trailer disc (after Play / Resume, before Also available), and the item menu offers Play Trailer. The menu is cache-only off the already-loaded parent: a related tile cannot steal it, and episode / season menus never offer it. No extras means no disc and no row.
Playback reuses
request_playwith the extra's rk / part,resume_ns = 0, HUD context"Trailer", andcontinuousomitted so EOS cannot Up-Next into a sibling extra.up_next_ofis already episode-gated; a clip successor would not arm the tile even if a queue came back larger than 1.metadata::current()stays the parent, so Go to Show after a show trailer still opens the show.Quality judging uses the extra's own bitrate. Using the parent's 4K figure (or
src_kbps = 0, whichCeiling::admitsfails closed on) would force every non-Auto rung through the encoder.The extras shelf (behind-the-scenes, featurettes, interviews) is still out of scope.
Detailkeepstrailer: Option<Extra>, not the extras vector. Parity gaps, the Plex Pass audit, anddocs/pms-api.md§4 say so.Supporting:
DetailScreencaches hero-chain and below-hero section geometry for the frame. Synopsis height and the episode strip'sblock_hare O(text) and used to be re-asked from everyplaceinrecord_stops. The cache is stamped off counts, string lengths, and pointer identity so an in-place season landing (pump_seasonrewritingCURRENTat a stable address) still rebuilds.SCREEN_SHAPES_PINmoves becauseAction::PlayTrailergrows the item-menu shape with the extra's play fields.CI fix
hostsim-feature host checks were failing to compile:player::engine'sload_in_flight_testsmodule (and two jail-refusal tests inplayer::mod) still called the pre-restructure API — free functionsengine_take/engine_install/engine(&mt), andstate()/start_bufferfeed(&mt)/reset_player_control_for_test()with the old argument-free signatures — left behind by thePlaybackSession/PlayerAdapterrefactor that landed earlier on this branch. Rewrote them to the pattern already used correctly elsewhere in the same file (load_refusal_tests,replay_after_stop_tests): a localPlayerAdapter/PlaybackSessionthreaded throughpump()/start_bufferfeed(),pa.engine()/pa.install()instead of the retired globals. Default-feature andhostsim-feature builds both now compile clean undercargo test --lib --no-run.Verification
Host tests cover the picker (primary preference, non-trailer primary ignored, extraType 1, empty Part), extras-wanted only for movie / show, the disc playing the extra from the start, a show disc not playing the on-deck episode, extras landing growing the disc without moving Play identity, a movie without extras offering nothing, Play Trailer cache-only on the loaded parent, trailer PlayQueues omitting
continuous, a clip queue row not arming Up-Next, quality judging the extra file not the parent or zero, and Go to Show after a trailer opening the loaded parent.Device / simulator still have to see the disc, the HUD context, and that EOS does not Up-Next.
make checkcannot see a pixel, and the extras GET is live PMS.