Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

Expose media playback state in snapshots#7

Merged
4fuu merged 4 commits into
mainfrom
feature/media-playback-state
Mar 28, 2026
Merged

Expose media playback state in snapshots#7
4fuu merged 4 commits into
mainfrom
feature/media-playback-state

Conversation

@4fuu
Copy link
Copy Markdown
Owner

@4fuu 4fuu commented Mar 28, 2026

Summary

  • Extract HTMLMediaElement playback state (paused/playing/ended, currentTime, duration, muted, resolution) in the content script's extractAttrs()
  • Add Media node variant on the Rust side (structure.rs) with dedicated fields
  • Render media nodes as <media> elements in XML output (xml.rs)
  • Handle Media in plugin runner exhaustive matches

Test plan

  • Open a page with <audio> or <video> elements
  • Run browser-cli page <session> and verify media elements appear with state attributes
  • Play/pause media and re-run page --fresh to confirm state updates
  • Verify --json output includes media fields

Closes #2

Mule added 2 commits March 28, 2026 15:18
Closes #2

Add media-specific state detection in the content script's extractAttrs()
for HTMLMediaElement instances, capturing playback state, current time,
duration, muted flag, and video resolution. On the Rust side, add a Media
node variant to structure.rs with corresponding XML rendering in xml.rs,
and handle the new variant in runner.rs and commands.rs match arms.
Add missing closing brace for the function body, which was causing
a compilation error due to an unclosed delimiter.
@4fuu
Copy link
Copy Markdown
Owner Author

4fuu commented Mar 28, 2026

@codex review this pr

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f06345856

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/plugin/runner.rs Outdated
}
}
Node::Text { .. } | Node::Heading { .. } => {}
Node::Text { .. } | Node::Heading { .. } | Node::Media { .. } => {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve media IDs in interactive target collection

Node::Media now receives eN IDs and is inserted into element_refs, but this branch excludes media from collect_interactive_targets, which is the only source used by resolve_interactive_target for plugin click/type selectors. As a result, a plugin step cannot resolve a media element even when the page output shows a valid eN ID (or a query like video), so media-related automation fails with “target not found” despite the element being addressable elsewhere.

Useful? React with 👍 / 👎.

@4fuu
Copy link
Copy Markdown
Owner Author

4fuu commented Mar 28, 2026

I checked this branch locally. I do not see an obvious blocking functional issue, and cargo test, npm run typecheck, and npm run build all pass.

That said, I do think one thing should be tightened up before merge: this PR changes the structuring rules and XML output, and per the repo collaboration rules it would be better to add the minimal necessary tests in src/page/structure.rs and src/page/xml.rs to lock in the new behavior.

In particular, it would help to cover:

  • <audio> / <video> being structured as Media
  • state/time/duration/muted/resolution being rendered into XML as expected
  • no unintended impact on existing node rendering boundaries

The implementation compiles and CI is green, but without tests around output behavior like this, regressions will be harder to catch later.

  • Codex

@4fuu 4fuu merged commit 95198f3 into main Mar 28, 2026
2 checks passed
@4fuu 4fuu deleted the feature/media-playback-state branch March 28, 2026 17:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Media playback state is not exposed in snapshots

1 participant