Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.0

* Add VideoPlayerOptions with audo mix mode

## 2.0.2

* Migrated tests to use pigeon correctly.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v0.1.0-experimental.10), do not edit directly.
// Autogenerated from Pigeon (v0.1.0-experimental.11), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import
import 'dart:async';
Expand Down Expand Up @@ -107,6 +107,23 @@ class PositionMessage {
}
}

class MixWithOthersMessage {
bool mixWithOthers;
// ignore: unused_element
Map<dynamic, dynamic> _toMap() {
final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{};
pigeonMap['mixWithOthers'] = mixWithOthers;
return pigeonMap;
}

// ignore: unused_element
static MixWithOthersMessage _fromMap(Map<dynamic, dynamic> pigeonMap) {
final MixWithOthersMessage result = MixWithOthersMessage();
result.mixWithOthers = pigeonMap['mixWithOthers'];
return result;
}
}

abstract class VideoPlayerApiTest {
void initialize();
TextureMessage create(CreateMessage arg);
Expand Down Expand Up @@ -407,4 +424,27 @@ class VideoPlayerApi {
// noop
}
}

Future<void> setMixWithOthers(MixWithOthersMessage arg) async {
final Map<dynamic, dynamic> requestMap = arg._toMap();
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers',
StandardMessageCodec());

final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
details: null);
} else if (replyMap['error'] != null) {
final Map<dynamic, dynamic> error = replyMap['error'];
throw PlatformException(
code: error['code'],
message: error['message'],
details: error['details']);
} else {
// noop
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ class MethodChannelVideoPlayer extends VideoPlayerPlatform {
return Texture(textureId: textureId);
}

@override
Future<void> setMixWithOthers(bool mixWithOthers) {
return _api.setMixWithOthers(
MixWithOthersMessage()..mixWithOthers = mixWithOthers,
);
}

EventChannel _eventChannelFor(int textureId) {
return EventChannel('flutter.io/videoPlayer/videoEvents$textureId');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ abstract class VideoPlayerPlatform {
throw UnimplementedError('buildView() has not been implemented.');
}

/// Sets the audio mode to mix with other sources
Future<void> setMixWithOthers(bool mixWithOthers) {
throw UnimplementedError('setMixWithOthers() has not been implemented.');
}

// This method makes sure that VideoPlayer isn't implemented with `implements`.
//
// See class doc for more details on why implementing this class is forbidden.
Expand Down Expand Up @@ -331,3 +336,13 @@ class DurationRange {
@override
int get hashCode => start.hashCode ^ end.hashCode;
}

/// [VideoPlayerOptions] can be optionally used to set additional player settings
class VideoPlayerOptions {
/// Set this to true to mix the video players audio with other audio sources.
/// The default value is false
final bool mixWithOthers;

/// set additional optional player settings
VideoPlayerOptions({this.mixWithOthers = false});
}
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: 2.0.2
version: 2.1.0

dependencies:
flutter:
Expand Down