Skip to content

Commit d313151

Browse files
rajveermalviyagnprice
authored andcommitted
deps: Update video_player 2.10.0, from 2.9.5
Changelog: https://pub.dev/packages/video_player/changelog#2100 One notable change is, support for opt-in use of Flutter platform view: flutter/packages#8810 This commit also reverts the commit that pinned `video_player` package: commit 2036178 deps: Pin video_player to 2.9.5 The latest version (2.10.0) makes significant changes internally and to the test API, which would require us to investigate and update our FakeVideoPlayerPlatform mock for tests. So, pin to the currently used version for now. Upon investigating, the changes to the public API seem mostly small, namely some deprecations in the platform interface class. Which is only used in our tests, specifically by FakeVideoPlayerPlatform. Otherwise, no behaviour change observed while testing, as we are using the default options, i.e not using Flutter platform view.
1 parent 20da4ac commit d313151

File tree

3 files changed

+33
-37
lines changed

3 files changed

+33
-37
lines changed

pubspec.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ packages:
847847
source: hosted
848848
version: "3.1.6"
849849
plugin_platform_interface:
850-
dependency: "direct dev"
850+
dependency: transitive
851851
description:
852852
name: plugin_platform_interface
853853
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
@@ -1199,10 +1199,10 @@ packages:
11991199
dependency: "direct main"
12001200
description:
12011201
name: video_player
1202-
sha256: "7d78f0cfaddc8c19d4cb2d3bebe1bfef11f2103b0a03e5398b303a1bf65eeb14"
1202+
sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a"
12031203
url: "https://pub.dev"
12041204
source: hosted
1205-
version: "2.9.5"
1205+
version: "2.10.0"
12061206
video_player_android:
12071207
dependency: transitive
12081208
description:
@@ -1223,10 +1223,10 @@ packages:
12231223
dependency: "direct dev"
12241224
description:
12251225
name: video_player_platform_interface
1226-
sha256: df534476c341ab2c6a835078066fc681b8265048addd853a1e3c78740316a844
1226+
sha256: cf2a1d29a284db648fd66cbd18aacc157f9862d77d2cc790f6f9678a46c1db5a
12271227
url: "https://pub.dev"
12281228
source: hosted
1229-
version: "6.3.0"
1229+
version: "6.4.0"
12301230
video_player_web:
12311231
dependency: transitive
12321232
description:

pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ dependencies:
6161
sqlite3_flutter_libs: ^0.5.13
6262
url_launcher: ^6.1.11
6363
url_launcher_android: ">=6.1.0"
64-
video_player: 2.9.5 # TODO unpin and upgrade to latest version
64+
video_player: ^2.10.0
6565
wakelock_plus: ^1.2.8
6666
zulip_plugin:
6767
path: ./packages/zulip_plugin
@@ -103,7 +103,6 @@ dev_dependencies:
103103
json_serializable: ^6.5.4
104104
legacy_checks: ^0.1.0
105105
pigeon: ^25.3.1
106-
plugin_platform_interface: ^2.1.8
107106
stack_trace: ^1.11.1
108107
test: ^1.23.1
109108
test_api: ^0.7.3

test/widgets/lightbox_test.dart

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import 'package:clock/clock.dart';
66
import 'package:flutter/services.dart';
77
import 'package:flutter_test/flutter_test.dart';
88
import 'package:flutter/material.dart';
9-
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
10-
import 'package:video_player_platform_interface/video_player_platform_interface.dart';
119
import 'package:video_player/video_player.dart';
10+
import 'package:video_player_platform_interface/video_player_platform_interface.dart';
1211
import 'package:zulip/api/model/events.dart';
1312
import 'package:zulip/api/model/model.dart';
1413
import 'package:zulip/model/localizations.dart';
@@ -32,16 +31,14 @@ const kTestVideoUrl = "https://a/video.mp4";
3231
const kTestUnsupportedVideoUrl = "https://a/unsupported.mp4";
3332
const kTestVideoDuration = Duration(seconds: 10);
3433

35-
class FakeVideoPlayerPlatform extends Fake
36-
with MockPlatformInterfaceMixin
37-
implements VideoPlayerPlatform {
34+
class FakeVideoPlayerPlatform extends VideoPlayerPlatform {
3835
static final FakeVideoPlayerPlatform instance = FakeVideoPlayerPlatform();
3936

4037
static void registerWith() {
4138
VideoPlayerPlatform.instance = instance;
4239
}
4340

44-
static const int _kTextureId = 0xffffffff;
41+
static const int _kPlayerId = 0xffffffff;
4542

4643
StreamController<VideoEvent> _streamController = StreamController<VideoEvent>();
4744
bool _hasError = false;
@@ -104,21 +101,21 @@ class FakeVideoPlayerPlatform extends Fake
104101
Future<void> init() async {}
105102

106103
@override
107-
Future<void> dispose(int textureId) async {
104+
Future<void> dispose(int playerId) async {
108105
if (_hasError) {
109106
assert(!initialized);
110-
assert(textureId == VideoPlayerController.kUninitializedTextureId);
107+
assert(playerId == VideoPlayerController.kUninitializedPlayerId);
111108
return;
112109
}
113110

114111
assert(initialized);
115-
assert(textureId == _kTextureId);
112+
assert(playerId == _kPlayerId);
116113
}
117114

118115
@override
119-
Future<int?> create(DataSource dataSource) async {
116+
Future<int?> createWithOptions(VideoCreationOptions options) async {
120117
assert(!initialized);
121-
if (dataSource.uri == kTestUnsupportedVideoUrl) {
118+
if (options.dataSource.uri == kTestUnsupportedVideoUrl) {
122119
_hasError = true;
123120
_streamController.addError(
124121
PlatformException(
@@ -135,24 +132,24 @@ class FakeVideoPlayerPlatform extends Fake
135132
size: const Size(100, 100),
136133
rotationCorrection: 0,
137134
));
138-
return _kTextureId;
135+
return _kPlayerId;
139136
}
140137

141138
@override
142-
Stream<VideoEvent> videoEventsFor(int textureId) {
143-
assert(textureId == _kTextureId);
139+
Stream<VideoEvent> videoEventsFor(int playerId) {
140+
assert(playerId == _kPlayerId);
144141
return _streamController.stream;
145142
}
146143

147144
@override
148-
Future<void> setLooping(int textureId, bool looping) async {
149-
assert(textureId == _kTextureId);
145+
Future<void> setLooping(int playerId, bool looping) async {
146+
assert(playerId == _kPlayerId);
150147
assert(!looping);
151148
}
152149

153150
@override
154-
Future<void> play(int textureId) async {
155-
assert(textureId == _kTextureId);
151+
Future<void> play(int playerId) async {
152+
assert(playerId == _kPlayerId);
156153
_stopwatch?.start();
157154
_streamController.add(VideoEvent(
158155
eventType: VideoEventType.isPlayingStateUpdate,
@@ -161,8 +158,8 @@ class FakeVideoPlayerPlatform extends Fake
161158
}
162159

163160
@override
164-
Future<void> pause(int textureId) async {
165-
assert(textureId == _kTextureId);
161+
Future<void> pause(int playerId) async {
162+
assert(playerId == _kPlayerId);
166163
_stopwatch?.stop();
167164
_streamController.add(VideoEvent(
168165
eventType: VideoEventType.isPlayingStateUpdate,
@@ -171,33 +168,33 @@ class FakeVideoPlayerPlatform extends Fake
171168
}
172169

173170
@override
174-
Future<void> setVolume(int textureId, double volume) async {
175-
assert(textureId == _kTextureId);
171+
Future<void> setVolume(int playerId, double volume) async {
172+
assert(playerId == _kPlayerId);
176173
}
177174

178175
@override
179-
Future<void> seekTo(int textureId, Duration pos) async {
176+
Future<void> seekTo(int playerId, Duration pos) async {
180177
_callLog.add('seekTo');
181-
assert(textureId == _kTextureId);
178+
assert(playerId == _kPlayerId);
182179

183180
_lastSetPosition = pos >= kTestVideoDuration ? kTestVideoDuration : pos;
184181
_stopwatch?.reset();
185182
}
186183

187184
@override
188-
Future<void> setPlaybackSpeed(int textureId, double speed) async {
189-
assert(textureId == _kTextureId);
185+
Future<void> setPlaybackSpeed(int playerId, double speed) async {
186+
assert(playerId == _kPlayerId);
190187
}
191188

192189
@override
193-
Future<Duration> getPosition(int textureId) async {
194-
assert(textureId == _kTextureId);
190+
Future<Duration> getPosition(int playerId) async {
191+
assert(playerId == _kPlayerId);
195192
return position;
196193
}
197194

198195
@override
199-
Widget buildView(int textureId) {
200-
assert(textureId == _kTextureId);
196+
Widget buildViewWithOptions(VideoViewOptions options) {
197+
assert(options.playerId == _kPlayerId);
201198
return const SizedBox(width: 100, height: 100);
202199
}
203200
}

0 commit comments

Comments
 (0)