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

Wt custom video player plugin - #4

Open
Atsumi3 wants to merge 15 commits into
mainfrom
wt-custom-video_player_plugin
Open

Wt custom video player plugin#4
Atsumi3 wants to merge 15 commits into
mainfrom
wt-custom-video_player_plugin

Conversation

@Atsumi3

@Atsumi3 Atsumi3 commented Aug 7, 2025

Copy link
Copy Markdown

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Copilot AI review requested due to automatic review settings August 7, 2025 01:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a custom video player plugin with buffer configuration capabilities and enhanced status methods. The changes introduce buffer management features and additional playback state retrieval functionality across iOS and Android platforms.

Key Changes:

  • Adds Buffer class to configure video buffer settings (min/max buffer durations, playback thresholds)
  • Implements getDuration() and getIsPlaying() methods for real-time status retrieval
  • Updates Pigeon API definitions and generated code for both iOS and Android platforms

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
video_player_platform_interface.dart Adds buffer configuration classes and new platform interface methods
video_player.dart Integrates buffer configuration into VideoPlayerController and adds duration/isPlaying getters
Android implementation files Implements buffer controls using ExoPlayer LoadControl and new API methods
iOS implementation files Implements buffer controls using AVPlayer preferredForwardBufferDuration
Pigeon message files Adds BufferMessage class and new API method definitions
Generated files Updates from Pigeon code generation for new APIs

}
}

/// バッファを調整するための各パラメーター

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Comment contains Japanese text. Documentation should be in English for consistency with the rest of the codebase.

Suggested change
/// バッファを調整するための各パラメーター
/// Parameters for adjusting the buffer.

Copilot uses AI. Check for mistakes.
Comment on lines +127 to +129
/// バッファを調整するための各パラメーター
/// 以下4つはAndroidで使うもの
/// iOSは[maxBufferMs]のみ使う

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Comment contains Japanese text. Documentation should be in English for consistency with the rest of the codebase.

Suggested change
/// バッファを調整するための各パラメーター
/// 以下4つはAndroidで使うもの
/// iOSは[maxBufferMs]のみ使う
/// Parameters for adjusting the buffer.
/// The following four parameters are used on Android.
/// On iOS, only [maxBufferMs] is used.

Copilot uses AI. Check for mistakes.
Comment on lines +127 to +129
/// バッファを調整するための各パラメーター
/// 以下4つはAndroidで使うもの
/// iOSは[maxBufferMs]のみ使う

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Comment contains Japanese text. Documentation should be in English for consistency with the rest of the codebase.

Suggested change
/// バッファを調整するための各パラメーター
/// 以下4つはAndroidで使うもの
/// iOSは[maxBufferMs]のみ使う
/// Parameters for adjusting the buffer.
/// The following four are used on Android.
/// On iOS, only [maxBufferMs] is used.

Copilot uses AI. Check for mistakes.
Comment on lines +467 to +468
/// AndroidとiOSでバッファの値を調整するためにセットします
/// nullの場合は各プラットフォームのPlayerのデフォルトの値が使われます

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Comment contains Japanese text. Documentation should be in English for consistency with the rest of the codebase.

Suggested change
/// AndroidとiOSでバッファの値を調整するためにセットします
/// nullの場合は各プラットフォームのPlayerのデフォルトの値が使われます
/// Set this to adjust the buffer values on Android and iOS.
/// If null, the default buffer values of each platform's player will be used.

Copilot uses AI. Check for mistakes.
Comment on lines +467 to +468
/// AndroidとiOSでバッファの値を調整するためにセットします
/// nullの場合は各プラットフォームのPlayerのデフォルトの値が使われます

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Comment contains Japanese text. Documentation should be in English for consistency with the rest of the codebase.

Suggested change
/// AndroidとiOSでバッファの値を調整するためにセットします
/// nullの場合は各プラットフォームのPlayerのデフォルトの値が使われます
/// Set this to adjust buffer values on Android and iOS.
/// If null, the default value of each platform's player will be used.

Copilot uses AI. Check for mistakes.
Comment thread packages/video_player/video_player/lib/video_player.dart Outdated
}

@override
Future<void> setBuffer(int textureId, Buffer buffer) {

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Missing implementation for getIsPlaying method. The interface defines this method but it's not implemented in this class.

Copilot uses AI. Check for mistakes.
Comment on lines +186 to +191

// Re-create the player with new buffer settings
ExoPlayerState currentState = ExoPlayerState.save(exoPlayer);
exoPlayer.release();
exoPlayer = createVideoPlayer();
currentState.restore(exoPlayer);

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

The setBuffer method recreates the entire ExoPlayer instance which may cause playback interruption. Consider if there's a way to update buffer settings without full recreation.

Suggested change
// Re-create the player with new buffer settings
ExoPlayerState currentState = ExoPlayerState.save(exoPlayer);
exoPlayer.release();
exoPlayer = createVideoPlayer();
currentState.restore(exoPlayer);
// Update the LoadControl on the existing player to apply new buffer settings
DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder();
if (buffer != null) {
builder
.setBufferDurationsMs(
buffer.getMinBufferMs(),
buffer.getMaxBufferMs(),
buffer.getBufferForPlaybackMs(),
buffer.getBufferForPlaybackAfterRebufferMs());
}
exoPlayer.setLoadControl(builder.build());

Copilot uses AI. Check for mistakes.
flutter:
sdk: flutter
video_player_platform_interface: ">=6.1.0 <7.0.0"
video_player_platform_interface: any

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Using 'any' for dependency version is not recommended as it can lead to version conflicts. Use a specific version range instead.

Suggested change
video_player_platform_interface: any
video_player_platform_interface: ^6.2.2

Copilot uses AI. Check for mistakes.
Comment on lines 25 to 31
dependency_overrides:
video_player_platform_interface:
git:
url: https://github.com/WinTicket/packages.git
path: packages/video_player/video_player_platform_interface
ref: 38856189efe8dece386b8968edadd98d61e0db63

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

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

Using dependency_overrides with external git repositories in production code can lead to maintenance issues and should be avoided.

Suggested change
dependency_overrides:
video_player_platform_interface:
git:
url: https://github.com/WinTicket/packages.git
path: packages/video_player/video_player_platform_interface
ref: 38856189efe8dece386b8968edadd98d61e0db63

Copilot uses AI. Check for mistakes.
Atsumi3 and others added 4 commits August 14, 2025 18:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
buffer.bufferForPlaybackAfterRebufferMs = (msg.getBufferForPlaybackAfterRebufferMs() == null)
? DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
: toIntExact(msg.getBufferForPlaybackAfterRebufferMs());
player.setBuffer(buffer);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

これも options にセットがいいかもです?

Future<Duration> getPosition(int textureId) async {
final int position = await _api.getPosition(textureId);
return Duration(milliseconds: position);
final int startResponse = await _api.start(textureId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

start呼んじゃってるかもです?

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.

3 participants