Skip to content

Commit 078360f

Browse files
Chris YangEgor
authored andcommitted
[video_player_platform_interface] fix setMixIWithOthers test channel (flutter#2968)
1 parent b671da9 commit 078360f

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

packages/video_player/video_player_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.1
2+
3+
* Fix mixWithOthers test channel.
4+
15
## 2.1.0
26

37
* Add VideoPlayerOptions with audo mix mode

packages/video_player/video_player_platform_interface/lib/messages.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ abstract class VideoPlayerApiTest {
134134
PositionMessage position(TextureMessage arg);
135135
void seekTo(PositionMessage arg);
136136
void pause(TextureMessage arg);
137+
void setMixWithOthers(MixWithOthersMessage arg);
137138
}
138139

139140
void VideoPlayerApiTestSetup(VideoPlayerApiTest api) {
@@ -225,6 +226,18 @@ void VideoPlayerApiTestSetup(VideoPlayerApiTest api) {
225226
return {};
226227
});
227228
}
229+
{
230+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
231+
'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers',
232+
StandardMessageCodec());
233+
channel.setMockMessageHandler((dynamic message) async {
234+
final Map<dynamic, dynamic> mapMessage = message as Map<dynamic, dynamic>;
235+
final MixWithOthersMessage input =
236+
MixWithOthersMessage._fromMap(mapMessage);
237+
api.setMixWithOthers(input);
238+
return {};
239+
});
240+
}
228241
}
229242

230243
class VideoPlayerApi {

packages/video_player/video_player_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the video_player plugin.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 2.1.0
6+
version: 2.1.1
77

88
dependencies:
99
flutter:

packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class _ApiLogger implements VideoPlayerApiTest {
1919
PositionMessage positionMessage;
2020
LoopingMessage loopingMessage;
2121
VolumeMessage volumeMessage;
22+
MixWithOthersMessage mixWithOthersMessage;
2223

2324
@override
2425
TextureMessage create(CreateMessage arg) {
@@ -50,6 +51,12 @@ class _ApiLogger implements VideoPlayerApiTest {
5051
textureMessage = arg;
5152
}
5253

54+
@override
55+
void setMixWithOthers(MixWithOthersMessage arg) {
56+
log.add('setMixWithOthers');
57+
mixWithOthersMessage = arg;
58+
}
59+
5360
@override
5461
PositionMessage position(TextureMessage arg) {
5562
log.add('position');
@@ -179,6 +186,16 @@ void main() {
179186
expect(log.textureMessage.textureId, 1);
180187
});
181188

189+
test('setMixWithOthers', () async {
190+
await player.setMixWithOthers(true);
191+
expect(log.log.last, 'setMixWithOthers');
192+
expect(log.mixWithOthersMessage.mixWithOthers, true);
193+
194+
await player.setMixWithOthers(false);
195+
expect(log.log.last, 'setMixWithOthers');
196+
expect(log.mixWithOthersMessage.mixWithOthers, false);
197+
});
198+
182199
test('setVolume', () async {
183200
await player.setVolume(1, 0.7);
184201
expect(log.log.last, 'setVolume');

0 commit comments

Comments
 (0)