Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/l10n/de-DE.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/en-US.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/es-ES.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/fr-FR.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/ja-JP.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/ko-KR.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/zh-Hans-CN.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/l10n/zh-Hant-TW.json

Large diffs are not rendered by default.

663 changes: 567 additions & 96 deletions lib/chat/video_player_view.dart

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4351,6 +4351,7 @@ abstract final class AppStringKeys {
'videoPlayerSeekBackwardTenSeconds';
static const videoPlayerSeekForwardTenSeconds =
'videoPlayerSeekForwardTenSeconds';
static const videoPlayerHoldPlaybackSpeed = 'videoPlayerHoldPlaybackSpeed';
static const videoPlayerStreamInspector = 'videoPlayerStreamInspector';
static const videoPlayerVideoNumber = 'videoPlayerVideoNumber';
static const videoPlayerVideoZoom = 'videoPlayerVideoZoom';
Expand Down
118 changes: 54 additions & 64 deletions test/mobile_fullscreen_video_player_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,72 +80,62 @@ void main() {
}
});

testWidgets(
'holding the right or left video edge repeatedly seeks and stops on release',
(tester) async {
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(390, 844);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.view.resetPhysicalSize);
final previousPlatform = VideoPlayerPlatform.instance;
final platform = _FakeMobileVideoPlatform();
VideoPlayerPlatform.instance = platform;
debugDefaultTargetPlatformOverride = TargetPlatform.android;
try {
SharedPreferences.setMockInitialValues(const {});
final sourcePath = File('pubspec.yaml').absolute.path;
await tester.pumpWidget(
MaterialApp(
locale: const Locale('en'),
localizationsDelegates: const [AppLocalizations.delegate],
supportedLocales: AppLocalizations.supportedLocales,
home: VideoPlayerView(
video: TdFileRef(id: 782, localPath: sourcePath),
initialPlaying: false,
onClose: () {},
streamQuery: _completedVideoQuery(sourcePath, fileId: 782),
),
testWidgets('holding a video edge raises the rate and stops on release', (
tester,
) async {
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(390, 844);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.view.resetPhysicalSize);
final previousPlatform = VideoPlayerPlatform.instance;
final platform = _FakeMobileVideoPlatform();
VideoPlayerPlatform.instance = platform;
debugDefaultTargetPlatformOverride = TargetPlatform.android;
try {
SharedPreferences.setMockInitialValues(const {});
final sourcePath = File('pubspec.yaml').absolute.path;
await tester.pumpWidget(
MaterialApp(
locale: const Locale('en'),
localizationsDelegates: const [AppLocalizations.delegate],
supportedLocales: AppLocalizations.supportedLocales,
home: VideoPlayerView(
video: TdFileRef(id: 782, localPath: sourcePath),
onClose: () {},
streamQuery: _completedVideoQuery(sourcePath, fileId: 782),
),
);
await _pumpUntilPlayerReady(tester);
await tester.tapAt(const Offset(360, 400));
await tester.pump(const Duration(milliseconds: 400));

final forward = await tester.startGesture(const Offset(360, 400));
await tester.pump(const Duration(milliseconds: 600));
expect(
find.byKey(const ValueKey('video-held-seek-indicator')),
findsOneWidget,
);
await tester.pump(const Duration(milliseconds: 1000));
expect(
platform.seekPositions.last,
greaterThanOrEqualTo(const Duration(seconds: 20)),
);
await forward.up();
await tester.pump();
expect(
find.byKey(const ValueKey('video-held-seek-indicator')),
findsNothing,
);
final countAfterRelease = platform.seekPositions.length;
await tester.pump(const Duration(seconds: 1));
expect(platform.seekPositions.length, countAfterRelease);
),
);
await _pumpUntilPlayerReady(tester);
await tester.runAsync(
() => Future<void>.delayed(const Duration(milliseconds: 200)),
);

final beforeBackward = platform.seekPositions.last;
final backward = await tester.startGesture(const Offset(30, 400));
await tester.pump(const Duration(milliseconds: 600));
await tester.pump(const Duration(milliseconds: 500));
expect(platform.seekPositions.last, lessThan(beforeBackward));
await backward.up();
await tester.pumpWidget(const SizedBox.shrink());
await _pumpUntilDisposed(tester, platform);
} finally {
VideoPlayerPlatform.instance = previousPlatform;
debugDefaultTargetPlatformOverride = null;
}
},
);
final forward = await tester.startGesture(const Offset(360, 400));
await tester.pump(const Duration(milliseconds: 600));
expect(find.text('2x'), findsOneWidget);
await tester.pump(const Duration(milliseconds: 1000));
expect(platform.playbackSpeeds, contains(2.0));
await forward.up();
await tester.pump();
expect(find.text('2x'), findsNothing);
final countAfterRelease = platform.playbackSpeeds.length;
await tester.pump(const Duration(seconds: 1));
expect(platform.playbackSpeeds.length, countAfterRelease);
expect(platform.playbackSpeeds.last, 1.0);

final backward = await tester.startGesture(const Offset(30, 400));
await tester.pump(const Duration(milliseconds: 600));
await tester.pump(const Duration(milliseconds: 500));
expect(platform.playbackSpeeds.last, 2.0);
await backward.up();
await tester.pumpWidget(const SizedBox.shrink());
await _pumpUntilDisposed(tester, platform);
} finally {
VideoPlayerPlatform.instance = previousPlatform;
debugDefaultTargetPlatformOverride = null;
}
});

testWidgets('split video returns to fullscreen through the app navigator', (
tester,
Expand Down
Loading
Loading