Implement video element for Slipstream#226
Merged
jverkoey merged 3 commits intoNov 5, 2025
Merged
Conversation
Add support for the HTML <video> element with a SwiftUI-like API. The implementation provides: - URL-based initializer for simple single-source videos - Content-based initializer for complex scenarios with multiple sources - Chainable modifiers for video attributes: controls, autoplay, muted, loop, width, height, and poster - Comprehensive test coverage - Updated documentation The Video element follows established Slipstream patterns and strikes a balance between W3C idioms and SwiftUI conventions.
Replace modifier methods with direct initializer parameters for a cleaner, more idiomatic API. Configuration options (controls, autoplay, muted, loop, width, height, poster) are now passed directly to the init methods instead of using a chain of modifier methods. This simplifies the implementation by: - Removing the private initializer - Removing all modifier methods - Exposing configuration directly in public initializers - Making the API more straightforward and easier to use Updated tests to use the new API.
Update test expectations to match the actual HTML output from SwiftSoup. SwiftSoup renders some boolean attributes (controls, muted) without the empty value (e.g., `controls` instead of `controls=""`), while others (autoplay, loop) include it (e.g., `autoplay=""`). Both formats are valid HTML5 for boolean attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for the HTML
The Video element follows established Slipstream patterns and strikes a balance between W3C idioms and SwiftUI conventions.
Part of #25