Skip to content

Commit

Permalink
[video_player_videohole] Merge media player code from avplay (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan authored Dec 19, 2023
1 parent 623cd21 commit dcbc02c
Show file tree
Hide file tree
Showing 29 changed files with 2,019 additions and 1,536 deletions.
4 changes: 4 additions & 0 deletions packages/video_player_videohole/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.0

* Merge media player code from avplay.

## 0.3.0

* Implement `httpHeaders` of `VideoPlayerController.network`.
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player_videohole/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use this package, add `video_player_videohole` as a dependency in your `pubsp

```yaml
dependencies:
video_player_videohole: ^0.3.0
video_player_videohole: ^0.4.0
```
Then you can import `video_player_videohole` in your Dart code:
Expand Down
129 changes: 105 additions & 24 deletions packages/video_player_videohole/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v10.0.0), do not edit directly.
// Autogenerated from Pigeon (v10.1.6), 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, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import

Expand Down Expand Up @@ -141,7 +141,7 @@ class TrackTypeMessage {

int playerId;

int trackType;
String trackType;

Object encode() {
return <Object?>[
Expand All @@ -154,7 +154,7 @@ class TrackTypeMessage {
result as List<Object?>;
return TrackTypeMessage(
playerId: result[0]! as int,
trackType: result[1]! as int,
trackType: result[1]! as String,
);
}
}
Expand All @@ -170,7 +170,7 @@ class SelectedTracksMessage {

int trackId;

int trackType;
String trackType;

Object encode() {
return <Object?>[
Expand All @@ -185,7 +185,7 @@ class SelectedTracksMessage {
return SelectedTracksMessage(
playerId: result[0]! as int,
trackId: result[1]! as int,
trackType: result[2]! as int,
trackType: result[2]! as String,
);
}
}
Expand Down Expand Up @@ -224,6 +224,7 @@ class CreateMessage {
this.formatHint,
this.httpHeaders,
this.drmConfigs,
this.playerOptions,
});

String? asset;
Expand All @@ -238,6 +239,8 @@ class CreateMessage {

Map<Object?, Object?>? drmConfigs;

Map<Object?, Object?>? playerOptions;

Object encode() {
return <Object?>[
asset,
Expand All @@ -246,6 +249,7 @@ class CreateMessage {
formatHint,
httpHeaders,
drmConfigs,
playerOptions,
];
}

Expand All @@ -260,6 +264,8 @@ class CreateMessage {
(result[4] as Map<Object?, Object?>?)?.cast<Object?, Object?>(),
drmConfigs:
(result[5] as Map<Object?, Object?>?)?.cast<Object?, Object?>(),
playerOptions:
(result[6] as Map<Object?, Object?>?)?.cast<Object?, Object?>(),
);
}
}
Expand Down Expand Up @@ -411,7 +417,8 @@ class VideoPlayerVideoholeApi {

Future<void> initialize() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.initialize', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.initialize',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
Expand All @@ -432,7 +439,8 @@ class VideoPlayerVideoholeApi {

Future<PlayerMessage> create(CreateMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.create', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.create',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -459,7 +467,8 @@ class VideoPlayerVideoholeApi {

Future<void> dispose(PlayerMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.dispose', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.dispose',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -481,7 +490,8 @@ class VideoPlayerVideoholeApi {

Future<void> setLooping(LoopingMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.setLooping', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setLooping',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -503,7 +513,8 @@ class VideoPlayerVideoholeApi {

Future<void> setVolume(VolumeMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.setVolume', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setVolume',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -525,7 +536,8 @@ class VideoPlayerVideoholeApi {

Future<void> setPlaybackSpeed(PlaybackSpeedMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.setPlaybackSpeed', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setPlaybackSpeed',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -547,7 +559,8 @@ class VideoPlayerVideoholeApi {

Future<void> play(PlayerMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.play', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.play',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -567,9 +580,10 @@ class VideoPlayerVideoholeApi {
}
}

Future<PositionMessage> position(PlayerMessage arg_msg) async {
Future<bool> setDeactivate(PlayerMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.position', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setDeactivate',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -590,13 +604,14 @@ class VideoPlayerVideoholeApi {
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as PositionMessage?)!;
return (replyList[0] as bool?)!;
}
}

Future<void> seekTo(PositionMessage arg_msg) async {
Future<bool> setActivate(PlayerMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.seekTo', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setActivate',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -611,14 +626,20 @@ class VideoPlayerVideoholeApi {
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return;
return (replyList[0] as bool?)!;
}
}

Future<TrackMessage> track(TrackTypeMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.track', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.track',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -643,9 +664,66 @@ class VideoPlayerVideoholeApi {
}
}

Future<void> setTrackSelection(SelectedTracksMessage arg_msg) async {
Future<bool> setTrackSelection(SelectedTracksMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setTrackSelection',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as bool?)!;
}
}

Future<PositionMessage> position(PlayerMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.position',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
);
} else if (replyList[0] == null) {
throw PlatformException(
code: 'null-error',
message: 'Host platform returned null value for non-null return value.',
);
} else {
return (replyList[0] as PositionMessage?)!;
}
}

Future<void> seekTo(PositionMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.setTrackSelection', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.seekTo',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -667,7 +745,8 @@ class VideoPlayerVideoholeApi {

Future<void> pause(PlayerMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.pause', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.pause',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -689,7 +768,8 @@ class VideoPlayerVideoholeApi {

Future<void> setMixWithOthers(MixWithOthersMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.setMixWithOthers', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setMixWithOthers',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand All @@ -711,7 +791,8 @@ class VideoPlayerVideoholeApi {

Future<void> setDisplayGeometry(GeometryMessage arg_msg) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.VideoPlayerVideoholeApi.setDisplayGeometry', codec,
'dev.flutter.pigeon.video_player_videohole.VideoPlayerVideoholeApi.setDisplayGeometry',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_msg]) as List<Object?>?;
Expand Down
Loading

0 comments on commit dcbc02c

Please sign in to comment.