Skip to content

Commit

Permalink
[video_player_web] Ignore mixWithOthers option (flutter#3561)
Browse files Browse the repository at this point in the history
The documentation is updated to note this option will be silently
ignored in web.

Signed-off-by: Leandro Lucarella <[email protected]>
  • Loading branch information
llucax authored and adsonpleal committed Feb 26, 2021
1 parent d14dba9 commit f3f1328
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.0-nullsafety.11

* Setting the `mixWithOthers` `VideoPlayerOptions` in web now is silently ignored instead of throwing an exception.

## 2.0.0-nullsafety.10

* Updated to video_player_platform_interface 4.0.
Expand Down
2 changes: 2 additions & 0 deletions packages/video_player/video_player/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ This plugin compiles for the web platform since version `0.10.5`, in recent enou
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.

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.

## Supported Formats

- On iOS, the backing player is [AVPlayer](https://developer.apple.com/documentation/avfoundation/avplayer).
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: video_player
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android, iOS, and web.
version: 2.0.0-nullsafety.10
version: 2.0.0-nullsafety.11
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player

flutter:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.0-nullsafety.1

* Add note about the `mixWithOthers` option being ignored on the web.

## 4.0.0-nullsafety.0

* Update to latest Pigeon.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ class DurationRange {
class VideoPlayerOptions {
/// Set this to true to mix the video players audio with other audio sources.
/// The default value is false
///
/// Note: This option will be silently ignored in the web platform (there is
/// currently no way to implement this feature in this platform).
final bool mixWithOthers;

/// set additional optional player settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the video_player plugin.
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 4.0.0-nullsafety.0
version: 4.0.0-nullsafety.1

dependencies:
flutter:
Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.0-nullsafety.4

* Calling `setMixWithOthers()` now is silently ignored instead of throwing an exception.

## 2.0.0-nullsafety.3

* Updated to video_player_platform_interface 4.0.
Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ The Web platform does **not** suppport `dart:io`, so attempts to create a `Video
Playing videos without prior interaction with the site might be prohibited
by the browser and lead to runtime errors. See also: https://goo.gl/xX8pDD.

## Mixing audio with other audio sources

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.

## Supported Formats

**Different web browsers support different sets of video codecs.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ class VideoPlayerPlugin extends VideoPlayerPlatform {
Widget buildView(int textureId) {
return HtmlElementView(viewType: 'videoPlayer-$textureId');
}

/// Sets the audio mode to mix with other sources (ignored)
@override
Future<void> setMixWithOthers(bool mixWithOthers) => Future<void>.value();
}

class _VideoPlayer {
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player_web/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: video_player_web
description: Web platform implementation of video_player.
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_web
version: 2.0.0-nullsafety.3
version: 2.0.0-nullsafety.4

flutter:
plugin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,10 @@ void main() {
expect(VideoPlayerPlatform.instance.buildView(textureId),
isInstanceOf<Widget>());
});

test('ignores setting mixWithOthers', () {
expect(VideoPlayerPlatform.instance.setMixWithOthers(true), completes);
expect(VideoPlayerPlatform.instance.setMixWithOthers(false), completes);
});
});
}

0 comments on commit f3f1328

Please sign in to comment.