Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit fa95cde

Browse files
authored
[video_player_web] Ignore mixWithOthers option (#3561)
The documentation is updated to note this option will be silently ignored in web. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent d2c011f commit fa95cde

File tree

11 files changed

+33
-3
lines changed

11 files changed

+33
-3
lines changed

packages/video_player/video_player/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.0-nullsafety.11
2+
3+
* Setting the `mixWithOthers` `VideoPlayerOptions` in web now is silently ignored instead of throwing an exception.
4+
15
## 2.0.0-nullsafety.10
26

37
* Updated to video_player_platform_interface 4.0.

packages/video_player/video_player/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ This plugin compiles for the web platform since version `0.10.5`, in recent enou
4848
4949
Different web browsers may have different video-playback capabilities (supported formats, autoplay...). Check [package:video_player_web](https://pub.dev/packages/video_player_web) for more web-specific information.
5050

51+
The `VideoPlayerOptions.mixWithOthers` option can't be implemented in web, at least at the moment. If you use this option in web it will be silently ignored.
52+
5153
## Supported Formats
5254

5355
- On iOS, the backing player is [AVPlayer](https://developer.apple.com/documentation/avfoundation/avplayer).

packages/video_player/video_player/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: video_player
22
description: Flutter plugin for displaying inline video with other Flutter
33
widgets on Android, iOS, and web.
4-
version: 2.0.0-nullsafety.10
4+
version: 2.0.0-nullsafety.11
55
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
66

77
flutter:

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+
## 4.0.0-nullsafety.1
2+
3+
* Add note about the `mixWithOthers` option being ignored on the web.
4+
15
## 4.0.0-nullsafety.0
26

37
* Update to latest Pigeon.

packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ class DurationRange {
346346
class VideoPlayerOptions {
347347
/// Set this to true to mix the video players audio with other audio sources.
348348
/// The default value is false
349+
///
350+
/// Note: This option will be silently ignored in the web platform (there is
351+
/// currently no way to implement this feature in this platform).
349352
final bool mixWithOthers;
350353

351354
/// set additional optional player settings

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: 4.0.0-nullsafety.0
6+
version: 4.0.0-nullsafety.1
77

88
dependencies:
99
flutter:

packages/video_player/video_player_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.0-nullsafety.4
2+
3+
* Calling `setMixWithOthers()` now is silently ignored instead of throwing an exception.
4+
15
## 2.0.0-nullsafety.3
26

37
* Updated to video_player_platform_interface 4.0.

packages/video_player/video_player_web/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ The Web platform does **not** suppport `dart:io`, so attempts to create a `Video
2828
Playing videos without prior interaction with the site might be prohibited
2929
by the browser and lead to runtime errors. See also: https://goo.gl/xX8pDD.
3030

31+
## Mixing audio with other audio sources
32+
33+
The `VideoPlayerOptions.mixWithOthers` option can't be implemented in web, at least at the moment. If you use this option it will be silently ignored.
34+
3135
## Supported Formats
3236

3337
**Different web browsers support different sets of video codecs.**

packages/video_player/video_player_web/lib/video_player_web.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ class VideoPlayerPlugin extends VideoPlayerPlatform {
144144
Widget buildView(int textureId) {
145145
return HtmlElementView(viewType: 'videoPlayer-$textureId');
146146
}
147+
148+
/// Sets the audio mode to mix with other sources (ignored)
149+
@override
150+
Future<void> setMixWithOthers(bool mixWithOthers) => Future<void>.value();
147151
}
148152

149153
class _VideoPlayer {

packages/video_player/video_player_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: video_player_web
22
description: Web platform implementation of video_player.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_web
4-
version: 2.0.0-nullsafety.3
4+
version: 2.0.0-nullsafety.4
55

66
flutter:
77
plugin:

packages/video_player/video_player_web/test/video_player_web_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,10 @@ void main() {
136136
expect(VideoPlayerPlatform.instance.buildView(textureId),
137137
isInstanceOf<Widget>());
138138
});
139+
140+
test('ignores setting mixWithOthers', () {
141+
expect(VideoPlayerPlatform.instance.setMixWithOthers(true), completes);
142+
expect(VideoPlayerPlatform.instance.setMixWithOthers(false), completes);
143+
});
139144
});
140145
}

0 commit comments

Comments
 (0)