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

Commit f5acfe5

Browse files
authored
[video-player] upgraded video_player_interface to use pigeon (#2617)
* [video-player] upgraded video_player_interface to use pigeon
1 parent 1e18d72 commit f5acfe5

File tree

4 files changed

+339
-59
lines changed

4 files changed

+339
-59
lines changed

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+
## 2.0.0
2+
3+
* Migrated to [pigeon](https://pub.dev/packages/pigeon).
4+
15
## 1.0.5
26

37
* Make the pedantic dev_dependency explicit.
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
// Autogenerated from Pigeon (v0.1.0-experimental.10), do not edit directly.
2+
// See also: https://pub.dev/packages/pigeon
3+
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import
4+
import 'dart:async';
5+
import 'package:flutter/services.dart';
6+
7+
class TextureMessage {
8+
int textureId;
9+
// ignore: unused_element
10+
Map<dynamic, dynamic> _toMap() {
11+
final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{};
12+
pigeonMap['textureId'] = textureId;
13+
return pigeonMap;
14+
}
15+
16+
// ignore: unused_element
17+
static TextureMessage _fromMap(Map<dynamic, dynamic> pigeonMap) {
18+
final TextureMessage result = TextureMessage();
19+
result.textureId = pigeonMap['textureId'];
20+
return result;
21+
}
22+
}
23+
24+
class CreateMessage {
25+
String asset;
26+
String uri;
27+
String packageName;
28+
String formatHint;
29+
// ignore: unused_element
30+
Map<dynamic, dynamic> _toMap() {
31+
final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{};
32+
pigeonMap['asset'] = asset;
33+
pigeonMap['uri'] = uri;
34+
pigeonMap['packageName'] = packageName;
35+
pigeonMap['formatHint'] = formatHint;
36+
return pigeonMap;
37+
}
38+
39+
// ignore: unused_element
40+
static CreateMessage _fromMap(Map<dynamic, dynamic> pigeonMap) {
41+
final CreateMessage result = CreateMessage();
42+
result.asset = pigeonMap['asset'];
43+
result.uri = pigeonMap['uri'];
44+
result.packageName = pigeonMap['packageName'];
45+
result.formatHint = pigeonMap['formatHint'];
46+
return result;
47+
}
48+
}
49+
50+
class LoopingMessage {
51+
int textureId;
52+
bool isLooping;
53+
// ignore: unused_element
54+
Map<dynamic, dynamic> _toMap() {
55+
final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{};
56+
pigeonMap['textureId'] = textureId;
57+
pigeonMap['isLooping'] = isLooping;
58+
return pigeonMap;
59+
}
60+
61+
// ignore: unused_element
62+
static LoopingMessage _fromMap(Map<dynamic, dynamic> pigeonMap) {
63+
final LoopingMessage result = LoopingMessage();
64+
result.textureId = pigeonMap['textureId'];
65+
result.isLooping = pigeonMap['isLooping'];
66+
return result;
67+
}
68+
}
69+
70+
class VolumeMessage {
71+
int textureId;
72+
double volume;
73+
// ignore: unused_element
74+
Map<dynamic, dynamic> _toMap() {
75+
final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{};
76+
pigeonMap['textureId'] = textureId;
77+
pigeonMap['volume'] = volume;
78+
return pigeonMap;
79+
}
80+
81+
// ignore: unused_element
82+
static VolumeMessage _fromMap(Map<dynamic, dynamic> pigeonMap) {
83+
final VolumeMessage result = VolumeMessage();
84+
result.textureId = pigeonMap['textureId'];
85+
result.volume = pigeonMap['volume'];
86+
return result;
87+
}
88+
}
89+
90+
class PositionMessage {
91+
int textureId;
92+
int position;
93+
// ignore: unused_element
94+
Map<dynamic, dynamic> _toMap() {
95+
final Map<dynamic, dynamic> pigeonMap = <dynamic, dynamic>{};
96+
pigeonMap['textureId'] = textureId;
97+
pigeonMap['position'] = position;
98+
return pigeonMap;
99+
}
100+
101+
// ignore: unused_element
102+
static PositionMessage _fromMap(Map<dynamic, dynamic> pigeonMap) {
103+
final PositionMessage result = PositionMessage();
104+
result.textureId = pigeonMap['textureId'];
105+
result.position = pigeonMap['position'];
106+
return result;
107+
}
108+
}
109+
110+
class VideoPlayerApi {
111+
Future<void> initialize() async {
112+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
113+
'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec());
114+
115+
final Map<dynamic, dynamic> replyMap = await channel.send(null);
116+
if (replyMap == null) {
117+
throw PlatformException(
118+
code: 'channel-error',
119+
message: 'Unable to establish connection on channel.',
120+
details: null);
121+
} else if (replyMap['error'] != null) {
122+
final Map<dynamic, dynamic> error = replyMap['error'];
123+
throw PlatformException(
124+
code: error['code'],
125+
message: error['message'],
126+
details: error['details']);
127+
} else {
128+
// noop
129+
}
130+
}
131+
132+
Future<TextureMessage> create(CreateMessage arg) async {
133+
final Map<dynamic, dynamic> requestMap = arg._toMap();
134+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
135+
'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec());
136+
137+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
138+
if (replyMap == null) {
139+
throw PlatformException(
140+
code: 'channel-error',
141+
message: 'Unable to establish connection on channel.',
142+
details: null);
143+
} else if (replyMap['error'] != null) {
144+
final Map<dynamic, dynamic> error = replyMap['error'];
145+
throw PlatformException(
146+
code: error['code'],
147+
message: error['message'],
148+
details: error['details']);
149+
} else {
150+
return TextureMessage._fromMap(replyMap['result']);
151+
}
152+
}
153+
154+
Future<void> dispose(TextureMessage arg) async {
155+
final Map<dynamic, dynamic> requestMap = arg._toMap();
156+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
157+
'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec());
158+
159+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
160+
if (replyMap == null) {
161+
throw PlatformException(
162+
code: 'channel-error',
163+
message: 'Unable to establish connection on channel.',
164+
details: null);
165+
} else if (replyMap['error'] != null) {
166+
final Map<dynamic, dynamic> error = replyMap['error'];
167+
throw PlatformException(
168+
code: error['code'],
169+
message: error['message'],
170+
details: error['details']);
171+
} else {
172+
// noop
173+
}
174+
}
175+
176+
Future<void> setLooping(LoopingMessage arg) async {
177+
final Map<dynamic, dynamic> requestMap = arg._toMap();
178+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
179+
'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec());
180+
181+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
182+
if (replyMap == null) {
183+
throw PlatformException(
184+
code: 'channel-error',
185+
message: 'Unable to establish connection on channel.',
186+
details: null);
187+
} else if (replyMap['error'] != null) {
188+
final Map<dynamic, dynamic> error = replyMap['error'];
189+
throw PlatformException(
190+
code: error['code'],
191+
message: error['message'],
192+
details: error['details']);
193+
} else {
194+
// noop
195+
}
196+
}
197+
198+
Future<void> setVolume(VolumeMessage arg) async {
199+
final Map<dynamic, dynamic> requestMap = arg._toMap();
200+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
201+
'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec());
202+
203+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
204+
if (replyMap == null) {
205+
throw PlatformException(
206+
code: 'channel-error',
207+
message: 'Unable to establish connection on channel.',
208+
details: null);
209+
} else if (replyMap['error'] != null) {
210+
final Map<dynamic, dynamic> error = replyMap['error'];
211+
throw PlatformException(
212+
code: error['code'],
213+
message: error['message'],
214+
details: error['details']);
215+
} else {
216+
// noop
217+
}
218+
}
219+
220+
Future<void> play(TextureMessage arg) async {
221+
final Map<dynamic, dynamic> requestMap = arg._toMap();
222+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
223+
'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec());
224+
225+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
226+
if (replyMap == null) {
227+
throw PlatformException(
228+
code: 'channel-error',
229+
message: 'Unable to establish connection on channel.',
230+
details: null);
231+
} else if (replyMap['error'] != null) {
232+
final Map<dynamic, dynamic> error = replyMap['error'];
233+
throw PlatformException(
234+
code: error['code'],
235+
message: error['message'],
236+
details: error['details']);
237+
} else {
238+
// noop
239+
}
240+
}
241+
242+
Future<PositionMessage> position(TextureMessage arg) async {
243+
final Map<dynamic, dynamic> requestMap = arg._toMap();
244+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
245+
'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec());
246+
247+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
248+
if (replyMap == null) {
249+
throw PlatformException(
250+
code: 'channel-error',
251+
message: 'Unable to establish connection on channel.',
252+
details: null);
253+
} else if (replyMap['error'] != null) {
254+
final Map<dynamic, dynamic> error = replyMap['error'];
255+
throw PlatformException(
256+
code: error['code'],
257+
message: error['message'],
258+
details: error['details']);
259+
} else {
260+
return PositionMessage._fromMap(replyMap['result']);
261+
}
262+
}
263+
264+
Future<void> seekTo(PositionMessage arg) async {
265+
final Map<dynamic, dynamic> requestMap = arg._toMap();
266+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
267+
'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec());
268+
269+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
270+
if (replyMap == null) {
271+
throw PlatformException(
272+
code: 'channel-error',
273+
message: 'Unable to establish connection on channel.',
274+
details: null);
275+
} else if (replyMap['error'] != null) {
276+
final Map<dynamic, dynamic> error = replyMap['error'];
277+
throw PlatformException(
278+
code: error['code'],
279+
message: error['message'],
280+
details: error['details']);
281+
} else {
282+
// noop
283+
}
284+
}
285+
286+
Future<void> pause(TextureMessage arg) async {
287+
final Map<dynamic, dynamic> requestMap = arg._toMap();
288+
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>(
289+
'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec());
290+
291+
final Map<dynamic, dynamic> replyMap = await channel.send(requestMap);
292+
if (replyMap == null) {
293+
throw PlatformException(
294+
code: 'channel-error',
295+
message: 'Unable to establish connection on channel.',
296+
details: null);
297+
} else if (replyMap['error'] != null) {
298+
final Map<dynamic, dynamic> error = replyMap['error'];
299+
throw PlatformException(
300+
code: error['code'],
301+
message: error['message'],
302+
details: error['details']);
303+
} else {
304+
// noop
305+
}
306+
}
307+
}

0 commit comments

Comments
 (0)