implement audio and video basic catalog components#802
implement audio and video basic catalog components#802andrewkolos wants to merge 30 commits intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces significant new functionality by implementing audioPlayer and video components, providing actual media playback capabilities across various platforms. However, a critical security concern exists: the handling of URLs from GenUI messages lacks validation, potentially leading to Client-Side Request Forgery or unauthorized access to local files. Strict URL scheme validation and domain allow-listing are recommended. Additionally, general feedback addresses improving asynchronous operations and optimizing logging practices.
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces audioPlayer and video components, which is a significant feature enhancement using the audioplayers and video_player packages. However, there are critical security concerns regarding the handling of URLs provided by the GenUI system. Specifically, the lack of URL scheme validation could lead to Server-Side Request Forgery (SSRF) or Local File Inclusion (LFI) if malicious URLs are processed. Additionally, an unhandled exception in Uri.parse within the Video component could lead to application crashes with malformed URLs. Beyond these security issues, consider simplifying the playback logic in the audio player, fixing a state management bug in the video player's volume controls, and addressing code duplication for better maintainability.
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
packages/genui/lib/src/catalog/basic_catalog_widgets/audio_player.dart
Outdated
Show resolved
Hide resolved
packages/genui/lib/src/catalog/basic_catalog_widgets/video.dart
Outdated
Show resolved
Hide resolved
…into audio-video-pr
|
Ready for review, but I'll have to look into #816 to get the main CI suite running against this PR again. The diff here is long, but it's mostly native plugin registration files being updated. |
59e5234 to
f49b028
Compare
Description
See prior discussion in proposal: https://docs.google.com/document/d/1cRPCuuGLmUYY-PGFXlf7mIhdOuM2rypfP1Cw3nj_myM/edit?usp=sharing
Closes #738. Closes #392. Closes #393. Closes #746.
Implements the
audioPlayerandvideocomponents in the basic catalog.audioPlayeris implemented simply, using a slider as the progress indicator/scrubbing control. The component also has your typical play/pause button, reading of the playhead position (e.g. 01:23), length of the audio file (e.g. 02:25), and a basic volume slider.videoPlayeris likewise simple. Not supported on Linux due to the lack of a lightweight, turnkey video rendering package available on pub; instead, a placeholder is shown to warn developers targeting Linux, who can write their own implementation. I chose to not wrap everything within a card, since I think it's unnecessary since all video controls can fit in a neat control bar directly below the video contents.Dependencies used and their sizes
audioplayersis used for audio streaming support.video_playeris used for video. TL;DR these 0.5-2MB to the app bundle.I did some crude before-and-after testing to see how the bundle_size of an app could change with these two new dependencies introduced.
I used examples/catalog_gallery as the test app.
I used the following package versions:
Here is the data:
Other things to note
Introducing dependencies carries other burdens other than unnecessarily inflating bundle sizes for those that do not have interest in the audio and video components. At the time of writing, one can be seen just by building for macOS:
swift compiler warnings
If such drawbacks prove to be troublesome in the long term, we can move audio and video components into a separate package and deprecate the existing ones.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-devrel channel on Discord.