Skip to content

fix(ui): Removed mediakit dependency from sdk#2828

Merged
renefloor merged 8 commits into
masterfrom
feat/remove-mediakit-dependency
Jul 22, 2026
Merged

fix(ui): Removed mediakit dependency from sdk#2828
renefloor merged 8 commits into
masterfrom
feat/remove-mediakit-dependency

Conversation

@renefloor

@renefloor renefloor commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-615

Github Issue: #2768

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

This PR removes the media_kit dependency in the stream_chat_flutter sdk. It's currently only used to play videos on Windows and Linux desktop platforms. For these platforms we used update the docs with a sample how to implement it yourselves as also done in the sample app.

Screenshots / Videos

Before After
img img

Summary by CodeRabbit

  • New Features

    • Video playback can now be customized via component builders (including an override for the video player).
    • The default video player is now publicly available for fallback implementations.
    • Exported video-player activity support for easier integration.
    • Updated sample app video playback for supported desktop platforms.
  • Bug Fixes

    • Improved video initialization flow with loading/error states and better handling of local vs network video sources.
  • Chores

    • Removed legacy VLC/media dependencies from the main package and updated sample dependency/runtime setup.
    • Updated secure storage version (including iOS framework wiring).

@renefloor renefloor changed the title Removed mediakit dependency from sdk fix(ui): Removed mediakit dependency from sdk Jul 21, 2026
Comment thread packages/stream_chat_flutter/lib/src/utils/device_segmentation.dart
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@renefloor, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4dbfb3aa-333a-4d1b-8501-45a669fb9142

📥 Commits

Reviewing files that changed from the base of the PR and between 6f50f54 and 6015aa1.

📒 Files selected for processing (5)
  • melos.yaml
  • packages/stream_chat_flutter/CHANGELOG.md
  • packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player.dart
  • packages/stream_chat_flutter/pubspec.yaml
  • sample_app/lib/app.dart
📝 Walkthrough

Walkthrough

Video playback is now replaceable through streamChatComponentBuilders, with the former implementation exposed as DefaultStreamVideoPlayer. Desktop MediaKit setup moves to the sample app, while package dependencies, generated plugin lists, and VLC management code are removed or updated.

Changes

Video player customization and default playback

Layer / File(s) Summary
Video player component API and default implementation
packages/stream_chat_flutter/lib/src/components/stream_chat_component_builders.dart, packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/..., packages/stream_chat_flutter/lib/stream_chat_flutter.dart, packages/stream_chat_flutter/CHANGELOG.md
Adds the optional video-player builder, introduces StreamVideoPlayerProps and DefaultStreamVideoPlayer, and embeds Chewie-based playback with local or network sources.
Sample app video playback integration
sample_app/lib/app.dart, sample_app/lib/widgets/video_player.dart, sample_app/pubspec.yaml, sample_app/ios/Runner.xcodeproj/project.pbxproj
Registers SampleAppVideoPlayer, initializes MediaKit on supported desktop platforms, adds media dependencies, and updates iOS embedded framework paths.
Media dependency and generated configuration cleanup
packages/stream_chat_flutter/pubspec.yaml, packages/stream_chat_flutter/example/*/flutter/generated_plugins.cmake, packages/stream_chat_flutter/lib/src/video/vlc/*, packages/stream_chat_flutter/test/src/mocks.dart, melos.yaml
Removes package MediaKit dependencies and VLC management, removes desktop plugin entries, updates the VLC mock, and bumps flutter_secure_storage.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StreamChat
  participant ChatComponentBuilder
  participant SampleAppVideoPlayer
  participant DefaultStreamVideoPlayer
  StreamChat->>ChatComponentBuilder: register videoPlayer builder
  ChatComponentBuilder->>SampleAppVideoPlayer: pass StreamVideoPlayerProps
  SampleAppVideoPlayer->>DefaultStreamVideoPlayer: use default outside supported desktop playback
  SampleAppVideoPlayer-->>StreamChat: render selected video player
Loading

Suggested reviewers: xsahil03x

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: removing the mediakit dependency from the SDK.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remove-mediakit-dependency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@renefloor
renefloor marked this pull request as ready for review July 22, 2026 08:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player.dart`:
- Around line 156-190: Guard the asynchronous initialization flow against
disposal: track the State’s disposed status and, after awaiting
_player.open(widget.attachment), stop before updating state or retaining the
player when disposal occurred. Ensure _player.open also rejects or exits after
its video initialization await if its own dispose path has run, preventing
ChewieController creation around a disposed VideoPlayerController; keep disposal
idempotent and avoid updates after unmounting.
- Around line 1-6: Make the video player implementation web-compatible by
isolating the dart:io-dependent File.fromUri and VideoPlayerController.file path
behind a conditional import or dart.library.io gate, removing the top-level
dart:io dependency from the widget. In the initialization flow, update the logic
after await video.initialize() to check whether the player has been disposed
before invoking _ChewieVideoPlayer.open(), and dispose or otherwise clean up the
initialized controller when teardown has already occurred.

In `@sample_app/ios/Runner.xcodeproj/project.pbxproj`:
- Around line 294-299: The iOS framework reference in the project’s framework
list is inconsistent with the declared dependency name. Update the dependency
entry in melos.yaml or regenerate the iOS project so the package and framework
use the same name, preserving the existing version constraint and generated
framework configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 295d778d-3164-4932-8fec-ceea0f615398

📥 Commits

Reviewing files that changed from the base of the PR and between 4dee989 and a15e582.

📒 Files selected for processing (19)
  • melos.yaml
  • packages/stream_chat_flutter/CHANGELOG.md
  • packages/stream_chat_flutter/example/linux/flutter/generated_plugins.cmake
  • packages/stream_chat_flutter/example/windows/flutter/generated_plugins.cmake
  • packages/stream_chat_flutter/lib/src/components/stream_chat_component_builders.dart
  • packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player.dart
  • packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player_default.dart
  • packages/stream_chat_flutter/lib/src/stream_chat.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_manager.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_manager_desktop.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_manager_web.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_stub.dart
  • packages/stream_chat_flutter/lib/stream_chat_flutter.dart
  • packages/stream_chat_flutter/pubspec.yaml
  • packages/stream_chat_flutter/test/src/mocks.dart
  • sample_app/ios/Runner.xcodeproj/project.pbxproj
  • sample_app/lib/app.dart
  • sample_app/lib/widgets/video_player.dart
  • sample_app/pubspec.yaml
💤 Files with no reviewable changes (10)
  • packages/stream_chat_flutter/example/linux/flutter/generated_plugins.cmake
  • packages/stream_chat_flutter/example/windows/flutter/generated_plugins.cmake
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_stub.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_manager.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_manager_desktop.dart
  • packages/stream_chat_flutter/lib/src/stream_chat.dart
  • packages/stream_chat_flutter/lib/src/video/vlc/vlc_manager_web.dart
  • packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player_default.dart
  • packages/stream_chat_flutter/pubspec.yaml
  • packages/stream_chat_flutter/test/src/mocks.dart

Comment on lines +1 to +6
import 'dart:io';

import 'package:chewie/chewie.dart';
import 'package:flutter/widgets.dart';
import 'package:stream_chat_flutter/src/media_gallery_preview/video_player/stream_video_player_default.dart';
import 'package:stream_chat_flutter/src/media_gallery_preview/video_player/stream_video_player_desktop.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:video_player/video_player.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does an unconditional import 'dart:io' in a Flutter package library fail Flutter web (dart2js/dart2wasm) compilation in current stable Flutter/Dart, or does it only throw UnimplementedError at the call site?

💡 Result:

An unconditional import of 'dart:io' in a Flutter package does not consistently cause a compilation failure for Flutter web; the behavior depends on the specific web compiler and build tooling being used [1][2]. In the current stable Flutter/Dart ecosystem: 1. Compilation Behavior: Some web compilers (such as dart2js) may allow the import to compile, while others (like those used by certain build configurations or older tooling) may reject it [1][2]. Because of this inconsistency, you cannot rely on it failing at compile time [1]. 2. Runtime Behavior: If the code compiles, attempting to access most 'dart:io' APIs at runtime will throw an UnsupportedError or similar runtime exception, as the library is not supported on the web [3][4]. 3. Recommended Practice: You should not use unconditional imports of 'dart:io' in cross-platform packages [3][5]. Instead, use conditional imports to safely include platform-specific code [6][5]. This ensures that your package remains compatible across both native and web platforms without triggering compile-time warnings or runtime errors in unsupported environments [3][5]. For official package development, use conditional imports to check for the presence of the library, as shown in this pattern [5]: import 'src/stub.dart' // Default implementation if (dart.library.io) 'src/io.dart' // dart:io implementation if (dart.library.js_interop) 'src/web.dart'; // Web implementation This approach is the standard, supported way to handle platform-specific dependencies [6][5].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== target file ==\n'
cat -n packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player.dart | sed -n '1,280p'

printf '\n== search for conditional platform handling ==\n'
rg -n "dart:io|kIsWeb|dart.library.io|conditional import|VideoPlayerController.file|File\\(" packages/stream_chat_flutter/lib/src -S

Repository: GetStream/stream-chat-flutter

Length of output: 15418


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== attachment model / localUri sources ==\n'
rg -n "localUri|assetUrl" packages/stream_chat_flutter/lib packages/stream_chat_flutter/lib/src -S

printf '\n== attachment handler platform split ==\n'
cat -n packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler.dart | sed -n '1,120p'
cat -n packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_base.dart | sed -n '1,260p'

Repository: GetStream/stream-chat-flutter

Length of output: 7976


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== usages of StreamVideoPlayer / DefaultStreamVideoPlayer ==\n'
rg -n "StreamVideoPlayer|DefaultStreamVideoPlayer|_ChewieVideoPlayer|StreamMediaGalleryPreviewItem" packages/stream_chat_flutter/lib -S

printf '\n== target preview file around video routing ==\n'
cat -n packages/stream_chat_flutter/lib/src/media_gallery_preview/stream_media_gallery_preview.dart | sed -n '120,220p'

Repository: GetStream/stream-chat-flutter

Length of output: 10863


Split the IO-only path and guard teardown

  • Move the File.fromUri(...) / VideoPlayerController.file(...) branch behind a conditional import or dart.library.io gate so the web-capable widget does not depend on dart:io at the top level.
  • Add a disposed check after await video.initialize(). dispose() can run while initialization is in flight, which lets _ChewieVideoPlayer.open() create a controller after teardown and leak the pair.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/stream_chat_flutter/lib/src/media_gallery_preview/video_player/stream_video_player.dart`
around lines 1 - 6, Make the video player implementation web-compatible by
isolating the dart:io-dependent File.fromUri and VideoPlayerController.file path
behind a conditional import or dart.library.io gate, removing the top-level
dart:io dependency from the widget. In the initialization flow, update the logic
after await video.initialize() to check whether the player has been disposed
before invoking _ChewieVideoPlayer.open(), and dispose or otherwise clean up the
initialized controller when teardown has already occurred.

Comment thread sample_app/ios/Runner.xcodeproj/project.pbxproj
Comment on lines +113 to +121
Attachment get attachment => props.attachment;

/// The 0-based index of this page in the enclosing
/// [StreamMediaGalleryPreview].
int get pageIndex => props.pageIndex;

/// Whether playback should auto-start when this page first becomes
/// active.
bool get autoplay => props.autoplay;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I personally would just remove these getters to be similar to other components in the SDK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This way the change is smaller for the rest of the code and also maybe somebody used StreamVideoPlayer.attachment somewhere for some reason. This is just safer and smaller change.

@renefloor
renefloor enabled auto-merge (squash) July 22, 2026 08:44
@renefloor
renefloor merged commit bf4df03 into master Jul 22, 2026
24 checks passed
@renefloor
renefloor deleted the feat/remove-mediakit-dependency branch July 22, 2026 08:52
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 66 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.48%. Comparing base (13beea6) to head (6015aa1).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...lery_preview/video_player/stream_video_player.dart 0.00% 65 Missing ⚠️
...src/components/stream_chat_component_builders.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2828      +/-   ##
==========================================
+ Coverage   71.35%   71.48%   +0.13%     
==========================================
  Files         430      426       -4     
  Lines       26945    26892      -53     
==========================================
- Hits        19226    19224       -2     
+ Misses       7719     7668      -51     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants