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

Commit e728df8

Browse files
committed
[video_player] upgraded video_player to use pigeon
1 parent ad6fd0d commit e728df8

11 files changed

Lines changed: 1246 additions & 265 deletions

File tree

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
// Autogenerated from Pigeon (v0.1.0-experimental.3), do not edit directly.
2+
// See also: https://pub.dev/packages/pigeon
3+
4+
package io.flutter.plugins.videoplayer;
5+
6+
import java.util.HashMap;
7+
8+
import io.flutter.plugin.common.BasicMessageChannel;
9+
import io.flutter.plugin.common.BinaryMessenger;
10+
import io.flutter.plugin.common.StandardMessageCodec;
11+
12+
/** Generated class from Pigeon. */
13+
public class Messages {
14+
15+
/** Generated class from Pigeon that represents data sent in messages. */
16+
public static class VoidMessage {
17+
HashMap toMap() {
18+
HashMap<String, Object> toMapResult = new HashMap<String, Object>();
19+
return toMapResult;
20+
}
21+
static VoidMessage fromMap(HashMap map) {
22+
VoidMessage fromMapResult = new VoidMessage();
23+
return fromMapResult;
24+
}
25+
}
26+
27+
/** Generated class from Pigeon that represents data sent in messages. */
28+
public static class TextureMessage {
29+
private Long textureId;
30+
public Long getTextureId() { return textureId; }
31+
public void setTextureId(Long setterArg) { this.textureId = setterArg; }
32+
33+
HashMap toMap() {
34+
HashMap<String, Object> toMapResult = new HashMap<String, Object>();
35+
toMapResult.put("textureId", textureId);
36+
return toMapResult;
37+
}
38+
static TextureMessage fromMap(HashMap map) {
39+
TextureMessage fromMapResult = new TextureMessage();
40+
fromMapResult.textureId = (int)map.get("textureId");
41+
return fromMapResult;
42+
}
43+
}
44+
45+
/** Generated class from Pigeon that represents data sent in messages. */
46+
public static class CreateMessage {
47+
private String asset;
48+
public String getAsset() { return asset; }
49+
public void setAsset(String setterArg) { this.asset = setterArg; }
50+
51+
private String uri;
52+
public String getUri() { return uri; }
53+
public void setUri(String setterArg) { this.uri = setterArg; }
54+
55+
private String package;
56+
public String getPackage() { return package; }
57+
public void setPackage(String setterArg) { this.package = setterArg; }
58+
59+
private String formatHint;
60+
public String getFormatHint() { return formatHint; }
61+
public void setFormatHint(String setterArg) { this.formatHint = setterArg; }
62+
63+
HashMap toMap() {
64+
HashMap<String, Object> toMapResult = new HashMap<String, Object>();
65+
toMapResult.put("asset", asset);
66+
toMapResult.put("uri", uri);
67+
toMapResult.put("package", package);
68+
toMapResult.put("formatHint", formatHint);
69+
return toMapResult;
70+
}
71+
static CreateMessage fromMap(HashMap map) {
72+
CreateMessage fromMapResult = new CreateMessage();
73+
fromMapResult.asset = (String)map.get("asset");
74+
fromMapResult.uri = (String)map.get("uri");
75+
fromMapResult.package = (String)map.get("package");
76+
fromMapResult.formatHint = (String)map.get("formatHint");
77+
return fromMapResult;
78+
}
79+
}
80+
81+
/** Generated class from Pigeon that represents data sent in messages. */
82+
public static class LoopingMessage {
83+
private Long textureId;
84+
public Long getTextureId() { return textureId; }
85+
public void setTextureId(Long setterArg) { this.textureId = setterArg; }
86+
87+
private Boolean isLooping;
88+
public Boolean getIsLooping() { return isLooping; }
89+
public void setIsLooping(Boolean setterArg) { this.isLooping = setterArg; }
90+
91+
HashMap toMap() {
92+
HashMap<String, Object> toMapResult = new HashMap<String, Object>();
93+
toMapResult.put("textureId", textureId);
94+
toMapResult.put("isLooping", isLooping);
95+
return toMapResult;
96+
}
97+
static LoopingMessage fromMap(HashMap map) {
98+
LoopingMessage fromMapResult = new LoopingMessage();
99+
fromMapResult.textureId = (int)map.get("textureId");
100+
fromMapResult.isLooping = (bool)map.get("isLooping");
101+
return fromMapResult;
102+
}
103+
}
104+
105+
/** Generated class from Pigeon that represents data sent in messages. */
106+
public static class VolumeMessage {
107+
private Long textureId;
108+
public Long getTextureId() { return textureId; }
109+
public void setTextureId(Long setterArg) { this.textureId = setterArg; }
110+
111+
private Double volume;
112+
public Double getVolume() { return volume; }
113+
public void setVolume(Double setterArg) { this.volume = setterArg; }
114+
115+
HashMap toMap() {
116+
HashMap<String, Object> toMapResult = new HashMap<String, Object>();
117+
toMapResult.put("textureId", textureId);
118+
toMapResult.put("volume", volume);
119+
return toMapResult;
120+
}
121+
static VolumeMessage fromMap(HashMap map) {
122+
VolumeMessage fromMapResult = new VolumeMessage();
123+
fromMapResult.textureId = (int)map.get("textureId");
124+
fromMapResult.volume = (double)map.get("volume");
125+
return fromMapResult;
126+
}
127+
}
128+
129+
/** Generated class from Pigeon that represents data sent in messages. */
130+
public static class PositionMessage {
131+
private Long textureId;
132+
public Long getTextureId() { return textureId; }
133+
public void setTextureId(Long setterArg) { this.textureId = setterArg; }
134+
135+
private Long position;
136+
public Long getPosition() { return position; }
137+
public void setPosition(Long setterArg) { this.position = setterArg; }
138+
139+
HashMap toMap() {
140+
HashMap<String, Object> toMapResult = new HashMap<String, Object>();
141+
toMapResult.put("textureId", textureId);
142+
toMapResult.put("position", position);
143+
return toMapResult;
144+
}
145+
static PositionMessage fromMap(HashMap map) {
146+
PositionMessage fromMapResult = new PositionMessage();
147+
fromMapResult.textureId = (int)map.get("textureId");
148+
fromMapResult.position = (int)map.get("position");
149+
return fromMapResult;
150+
}
151+
}
152+
153+
/** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
154+
public interface VideoPlayerApi {
155+
VoidMessage initialize(VoidMessage arg);
156+
TextureMessage create(CreateMessage arg);
157+
VoidMessage dispose(TextureMessage arg);
158+
VoidMessage setLooping(LoopingMessage arg);
159+
VoidMessage setVolume(VolumeMessage arg);
160+
VoidMessage play(TextureMessage arg);
161+
PositionMessage position(TextureMessage arg);
162+
VoidMessage seekTo(PositionMessage arg);
163+
VoidMessage pause(TextureMessage arg);
164+
165+
/** Sets up an instance of `VideoPlayerApi` to handle messages through the `binaryMessenger` */
166+
public static void setup(BinaryMessenger binaryMessenger, VideoPlayerApi api) {
167+
{
168+
BasicMessageChannel<Object> channel =
169+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.initialize", new StandardMessageCodec());
170+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
171+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
172+
VoidMessage input = VoidMessage.fromMap((HashMap)message);
173+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
174+
try {
175+
VoidMessage output = api.initialize(input);
176+
wrapped.put("result", output.toMap());
177+
}
178+
catch (Exception exception) {
179+
wrapped.put("error", wrapError(exception));
180+
}
181+
reply.reply(wrapped);
182+
}
183+
});
184+
}
185+
{
186+
BasicMessageChannel<Object> channel =
187+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.create", new StandardMessageCodec());
188+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
189+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
190+
CreateMessage input = CreateMessage.fromMap((HashMap)message);
191+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
192+
try {
193+
TextureMessage output = api.create(input);
194+
wrapped.put("result", output.toMap());
195+
}
196+
catch (Exception exception) {
197+
wrapped.put("error", wrapError(exception));
198+
}
199+
reply.reply(wrapped);
200+
}
201+
});
202+
}
203+
{
204+
BasicMessageChannel<Object> channel =
205+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.dispose", new StandardMessageCodec());
206+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
207+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
208+
TextureMessage input = TextureMessage.fromMap((HashMap)message);
209+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
210+
try {
211+
VoidMessage output = api.dispose(input);
212+
wrapped.put("result", output.toMap());
213+
}
214+
catch (Exception exception) {
215+
wrapped.put("error", wrapError(exception));
216+
}
217+
reply.reply(wrapped);
218+
}
219+
});
220+
}
221+
{
222+
BasicMessageChannel<Object> channel =
223+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setLooping", new StandardMessageCodec());
224+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
225+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
226+
LoopingMessage input = LoopingMessage.fromMap((HashMap)message);
227+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
228+
try {
229+
VoidMessage output = api.setLooping(input);
230+
wrapped.put("result", output.toMap());
231+
}
232+
catch (Exception exception) {
233+
wrapped.put("error", wrapError(exception));
234+
}
235+
reply.reply(wrapped);
236+
}
237+
});
238+
}
239+
{
240+
BasicMessageChannel<Object> channel =
241+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.setVolume", new StandardMessageCodec());
242+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
243+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
244+
VolumeMessage input = VolumeMessage.fromMap((HashMap)message);
245+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
246+
try {
247+
VoidMessage output = api.setVolume(input);
248+
wrapped.put("result", output.toMap());
249+
}
250+
catch (Exception exception) {
251+
wrapped.put("error", wrapError(exception));
252+
}
253+
reply.reply(wrapped);
254+
}
255+
});
256+
}
257+
{
258+
BasicMessageChannel<Object> channel =
259+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.play", new StandardMessageCodec());
260+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
261+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
262+
TextureMessage input = TextureMessage.fromMap((HashMap)message);
263+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
264+
try {
265+
VoidMessage output = api.play(input);
266+
wrapped.put("result", output.toMap());
267+
}
268+
catch (Exception exception) {
269+
wrapped.put("error", wrapError(exception));
270+
}
271+
reply.reply(wrapped);
272+
}
273+
});
274+
}
275+
{
276+
BasicMessageChannel<Object> channel =
277+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.position", new StandardMessageCodec());
278+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
279+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
280+
TextureMessage input = TextureMessage.fromMap((HashMap)message);
281+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
282+
try {
283+
PositionMessage output = api.position(input);
284+
wrapped.put("result", output.toMap());
285+
}
286+
catch (Exception exception) {
287+
wrapped.put("error", wrapError(exception));
288+
}
289+
reply.reply(wrapped);
290+
}
291+
});
292+
}
293+
{
294+
BasicMessageChannel<Object> channel =
295+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.seekTo", new StandardMessageCodec());
296+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
297+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
298+
PositionMessage input = PositionMessage.fromMap((HashMap)message);
299+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
300+
try {
301+
VoidMessage output = api.seekTo(input);
302+
wrapped.put("result", output.toMap());
303+
}
304+
catch (Exception exception) {
305+
wrapped.put("error", wrapError(exception));
306+
}
307+
reply.reply(wrapped);
308+
}
309+
});
310+
}
311+
{
312+
BasicMessageChannel<Object> channel =
313+
new BasicMessageChannel<Object>(binaryMessenger, "dev.flutter.pigeon.VideoPlayerApi.pause", new StandardMessageCodec());
314+
channel.setMessageHandler(new BasicMessageChannel.MessageHandler<Object>() {
315+
public void onMessage(Object message, BasicMessageChannel.Reply<Object> reply) {
316+
TextureMessage input = TextureMessage.fromMap((HashMap)message);
317+
HashMap<String, HashMap> wrapped = new HashMap<String, HashMap>();
318+
try {
319+
VoidMessage output = api.pause(input);
320+
wrapped.put("result", output.toMap());
321+
}
322+
catch (Exception exception) {
323+
wrapped.put("error", wrapError(exception));
324+
}
325+
reply.reply(wrapped);
326+
}
327+
});
328+
}
329+
}
330+
}
331+
private static HashMap wrapError(Exception exception) {
332+
HashMap<String, Object> errorMap = new HashMap<String, Object>();
333+
errorMap.put("message", exception.toString());
334+
errorMap.put("code", null);
335+
errorMap.put("details", null);
336+
return errorMap;
337+
}
338+
}

0 commit comments

Comments
 (0)