This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[video-player] upgraded video_player_interface to use pigeon #2617
Merged
gaaclarke
merged 4 commits into
flutter:master
from
gaaclarke:video-player-interface-pigeon
May 7, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c6740f8
[video-player] upgraded video_player_interface to use pigeon
gaaclarke 6ede8bf
temporary adjustment of version to test CI before the breaking change
gaaclarke ecdeb4f
ci didn't like the old version
gaaclarke f5b229b
moved back to 2.0.0 now that CI is done
gaaclarke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/video_player/video_player_platform_interface/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
307 changes: 307 additions & 0 deletions
307
packages/video_player/video_player_platform_interface/lib/messages.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,307 @@ | ||
| // Autogenerated from Pigeon (v0.1.0-experimental.10), 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'; | ||
| import 'package:flutter/services.dart'; | ||
|
|
||
| class TextureMessage { | ||
| int textureId; | ||
| // ignore: unused_element | ||
| Map<dynamic, dynamic> _toMap() { | ||
| final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{}; | ||
| pigeonMap['textureId'] = textureId; | ||
| return pigeonMap; | ||
| } | ||
|
|
||
| // ignore: unused_element | ||
| static TextureMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | ||
| final TextureMessage result = TextureMessage(); | ||
| result.textureId = pigeonMap['textureId']; | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| class CreateMessage { | ||
| String asset; | ||
| String uri; | ||
| String packageName; | ||
| String formatHint; | ||
| // ignore: unused_element | ||
| Map<dynamic, dynamic> _toMap() { | ||
| final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{}; | ||
| pigeonMap['asset'] = asset; | ||
| pigeonMap['uri'] = uri; | ||
| pigeonMap['packageName'] = packageName; | ||
| pigeonMap['formatHint'] = formatHint; | ||
| return pigeonMap; | ||
| } | ||
|
|
||
| // ignore: unused_element | ||
| static CreateMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | ||
| final CreateMessage result = CreateMessage(); | ||
| result.asset = pigeonMap['asset']; | ||
| result.uri = pigeonMap['uri']; | ||
| result.packageName = pigeonMap['packageName']; | ||
| result.formatHint = pigeonMap['formatHint']; | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| class LoopingMessage { | ||
| int textureId; | ||
| bool isLooping; | ||
| // ignore: unused_element | ||
| Map<dynamic, dynamic> _toMap() { | ||
| final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{}; | ||
| pigeonMap['textureId'] = textureId; | ||
| pigeonMap['isLooping'] = isLooping; | ||
| return pigeonMap; | ||
| } | ||
|
|
||
| // ignore: unused_element | ||
| static LoopingMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | ||
| final LoopingMessage result = LoopingMessage(); | ||
| result.textureId = pigeonMap['textureId']; | ||
| result.isLooping = pigeonMap['isLooping']; | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| class VolumeMessage { | ||
| int textureId; | ||
| double volume; | ||
| // ignore: unused_element | ||
| Map<dynamic, dynamic> _toMap() { | ||
| final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{}; | ||
| pigeonMap['textureId'] = textureId; | ||
| pigeonMap['volume'] = volume; | ||
| return pigeonMap; | ||
| } | ||
|
|
||
| // ignore: unused_element | ||
| static VolumeMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | ||
| final VolumeMessage result = VolumeMessage(); | ||
| result.textureId = pigeonMap['textureId']; | ||
| result.volume = pigeonMap['volume']; | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| class PositionMessage { | ||
| int textureId; | ||
| int position; | ||
| // ignore: unused_element | ||
| Map<dynamic, dynamic> _toMap() { | ||
| final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{}; | ||
| pigeonMap['textureId'] = textureId; | ||
| pigeonMap['position'] = position; | ||
| return pigeonMap; | ||
| } | ||
|
|
||
| // ignore: unused_element | ||
| static PositionMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | ||
| final PositionMessage result = PositionMessage(); | ||
| result.textureId = pigeonMap['textureId']; | ||
| result.position = pigeonMap['position']; | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| class VideoPlayerApi { | ||
| Future<void> initialize() async { | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec()); | ||
|
|
||
| final Map<dynamic, dynamic> replyMap = await channel.send(null); | ||
| if (replyMap == null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nits: and remove the noop else |
||
| 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 | ||
| } | ||
| } | ||
|
|
||
| Future<TextureMessage> create(CreateMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec()); | ||
|
|
||
| final Map<dynamic, dynamic> replyMap = await channel.send(requestMap); | ||
| if (replyMap == null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nits: |
||
| 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 { | ||
| return TextureMessage._fromMap(replyMap['result']); | ||
| } | ||
| } | ||
|
|
||
| Future<void> dispose(TextureMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.dispose', 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 | ||
| } | ||
| } | ||
|
|
||
| Future<void> setLooping(LoopingMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.setLooping', 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 | ||
| } | ||
| } | ||
|
|
||
| Future<void> setVolume(VolumeMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.setVolume', 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 | ||
| } | ||
| } | ||
|
|
||
| Future<void> play(TextureMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.play', 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 | ||
| } | ||
| } | ||
|
|
||
| Future<PositionMessage> position(TextureMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.position', 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 { | ||
| return PositionMessage._fromMap(replyMap['result']); | ||
| } | ||
| } | ||
|
|
||
| Future<void> seekTo(PositionMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.seekTo', 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 | ||
| } | ||
| } | ||
|
|
||
| Future<void> pause(TextureMessage arg) async { | ||
| final Map<dynamic, dynamic> requestMap = arg._toMap(); | ||
| const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
| 'dev.flutter.pigeon.VideoPlayerApi.pause', 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 | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it is possible for pigeon to know the type of the parameters and generate the map with different params.
It's not necessary tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to change it to Map<String, dynamic>, i just haven't gotten around to it. I'm kind of stuck with what the standard codec supports.