@@ -65,18 +65,6 @@ protected static ArrayList<Object> wrapError(@NonNull Throwable exception) {
65
65
@ Retention (CLASS )
66
66
@interface CanIgnoreReturnValue {}
67
67
68
- /** Pigeon equivalent of VideoViewType. */
69
- public enum PlatformVideoViewType {
70
- TEXTURE_VIEW (0 ),
71
- PLATFORM_VIEW (1 );
72
-
73
- final int index ;
74
-
75
- PlatformVideoViewType (final int index ) {
76
- this .index = index ;
77
- }
78
- }
79
-
80
68
/** Pigeon equivalent of video_platform_interface's VideoFormat. */
81
69
public enum PlatformVideoFormat {
82
70
DASH (0 ),
@@ -163,7 +151,7 @@ ArrayList<Object> toList() {
163
151
}
164
152
165
153
/** Generated class from Pigeon that represents data sent in messages. */
166
- public static final class CreateMessage {
154
+ public static final class CreationOptions {
167
155
private @ NonNull String uri ;
168
156
169
157
public @ NonNull String getUri () {
@@ -210,18 +198,8 @@ public void setUserAgent(@Nullable String setterArg) {
210
198
this .userAgent = setterArg ;
211
199
}
212
200
213
- private @ Nullable PlatformVideoViewType viewType ;
214
-
215
- public @ Nullable PlatformVideoViewType getViewType () {
216
- return viewType ;
217
- }
218
-
219
- public void setViewType (@ Nullable PlatformVideoViewType setterArg ) {
220
- this .viewType = setterArg ;
221
- }
222
-
223
201
/** Constructor is non-public to enforce null safety; use Builder. */
224
- CreateMessage () {}
202
+ CreationOptions () {}
225
203
226
204
@ Override
227
205
public boolean equals (Object o ) {
@@ -231,17 +209,16 @@ public boolean equals(Object o) {
231
209
if (o == null || getClass () != o .getClass ()) {
232
210
return false ;
233
211
}
234
- CreateMessage that = (CreateMessage ) o ;
212
+ CreationOptions that = (CreationOptions ) o ;
235
213
return uri .equals (that .uri )
236
214
&& Objects .equals (formatHint , that .formatHint )
237
215
&& httpHeaders .equals (that .httpHeaders )
238
- && Objects .equals (userAgent , that .userAgent )
239
- && Objects .equals (viewType , that .viewType );
216
+ && Objects .equals (userAgent , that .userAgent );
240
217
}
241
218
242
219
@ Override
243
220
public int hashCode () {
244
- return Objects .hash (uri , formatHint , httpHeaders , userAgent , viewType );
221
+ return Objects .hash (uri , formatHint , httpHeaders , userAgent );
245
222
}
246
223
247
224
public static final class Builder {
@@ -278,38 +255,28 @@ public static final class Builder {
278
255
return this ;
279
256
}
280
257
281
- private @ Nullable PlatformVideoViewType viewType ;
282
-
283
- @ CanIgnoreReturnValue
284
- public @ NonNull Builder setViewType (@ Nullable PlatformVideoViewType setterArg ) {
285
- this .viewType = setterArg ;
286
- return this ;
287
- }
288
-
289
- public @ NonNull CreateMessage build () {
290
- CreateMessage pigeonReturn = new CreateMessage ();
258
+ public @ NonNull CreationOptions build () {
259
+ CreationOptions pigeonReturn = new CreationOptions ();
291
260
pigeonReturn .setUri (uri );
292
261
pigeonReturn .setFormatHint (formatHint );
293
262
pigeonReturn .setHttpHeaders (httpHeaders );
294
263
pigeonReturn .setUserAgent (userAgent );
295
- pigeonReturn .setViewType (viewType );
296
264
return pigeonReturn ;
297
265
}
298
266
}
299
267
300
268
@ NonNull
301
269
ArrayList <Object > toList () {
302
- ArrayList <Object > toListResult = new ArrayList <>(5 );
270
+ ArrayList <Object > toListResult = new ArrayList <>(4 );
303
271
toListResult .add (uri );
304
272
toListResult .add (formatHint );
305
273
toListResult .add (httpHeaders );
306
274
toListResult .add (userAgent );
307
- toListResult .add (viewType );
308
275
return toListResult ;
309
276
}
310
277
311
- static @ NonNull CreateMessage fromList (@ NonNull ArrayList <Object > pigeonVar_list ) {
312
- CreateMessage pigeonResult = new CreateMessage ();
278
+ static @ NonNull CreationOptions fromList (@ NonNull ArrayList <Object > pigeonVar_list ) {
279
+ CreationOptions pigeonResult = new CreationOptions ();
313
280
Object uri = pigeonVar_list .get (0 );
314
281
pigeonResult .setUri ((String ) uri );
315
282
Object formatHint = pigeonVar_list .get (1 );
@@ -318,8 +285,98 @@ ArrayList<Object> toList() {
318
285
pigeonResult .setHttpHeaders ((Map <String , String >) httpHeaders );
319
286
Object userAgent = pigeonVar_list .get (3 );
320
287
pigeonResult .setUserAgent ((String ) userAgent );
321
- Object viewType = pigeonVar_list .get (4 );
322
- pigeonResult .setViewType ((PlatformVideoViewType ) viewType );
288
+ return pigeonResult ;
289
+ }
290
+ }
291
+
292
+ /** Generated class from Pigeon that represents data sent in messages. */
293
+ public static final class TexturePlayerIds {
294
+ private @ NonNull Long playerId ;
295
+
296
+ public @ NonNull Long getPlayerId () {
297
+ return playerId ;
298
+ }
299
+
300
+ public void setPlayerId (@ NonNull Long setterArg ) {
301
+ if (setterArg == null ) {
302
+ throw new IllegalStateException ("Nonnull field \" playerId\" is null." );
303
+ }
304
+ this .playerId = setterArg ;
305
+ }
306
+
307
+ private @ NonNull Long textureId ;
308
+
309
+ public @ NonNull Long getTextureId () {
310
+ return textureId ;
311
+ }
312
+
313
+ public void setTextureId (@ NonNull Long setterArg ) {
314
+ if (setterArg == null ) {
315
+ throw new IllegalStateException ("Nonnull field \" textureId\" is null." );
316
+ }
317
+ this .textureId = setterArg ;
318
+ }
319
+
320
+ /** Constructor is non-public to enforce null safety; use Builder. */
321
+ TexturePlayerIds () {}
322
+
323
+ @ Override
324
+ public boolean equals (Object o ) {
325
+ if (this == o ) {
326
+ return true ;
327
+ }
328
+ if (o == null || getClass () != o .getClass ()) {
329
+ return false ;
330
+ }
331
+ TexturePlayerIds that = (TexturePlayerIds ) o ;
332
+ return playerId .equals (that .playerId ) && textureId .equals (that .textureId );
333
+ }
334
+
335
+ @ Override
336
+ public int hashCode () {
337
+ return Objects .hash (playerId , textureId );
338
+ }
339
+
340
+ public static final class Builder {
341
+
342
+ private @ Nullable Long playerId ;
343
+
344
+ @ CanIgnoreReturnValue
345
+ public @ NonNull Builder setPlayerId (@ NonNull Long setterArg ) {
346
+ this .playerId = setterArg ;
347
+ return this ;
348
+ }
349
+
350
+ private @ Nullable Long textureId ;
351
+
352
+ @ CanIgnoreReturnValue
353
+ public @ NonNull Builder setTextureId (@ NonNull Long setterArg ) {
354
+ this .textureId = setterArg ;
355
+ return this ;
356
+ }
357
+
358
+ public @ NonNull TexturePlayerIds build () {
359
+ TexturePlayerIds pigeonReturn = new TexturePlayerIds ();
360
+ pigeonReturn .setPlayerId (playerId );
361
+ pigeonReturn .setTextureId (textureId );
362
+ return pigeonReturn ;
363
+ }
364
+ }
365
+
366
+ @ NonNull
367
+ ArrayList <Object > toList () {
368
+ ArrayList <Object > toListResult = new ArrayList <>(2 );
369
+ toListResult .add (playerId );
370
+ toListResult .add (textureId );
371
+ return toListResult ;
372
+ }
373
+
374
+ static @ NonNull TexturePlayerIds fromList (@ NonNull ArrayList <Object > pigeonVar_list ) {
375
+ TexturePlayerIds pigeonResult = new TexturePlayerIds ();
376
+ Object playerId = pigeonVar_list .get (0 );
377
+ pigeonResult .setPlayerId ((Long ) playerId );
378
+ Object textureId = pigeonVar_list .get (1 );
379
+ pigeonResult .setTextureId ((Long ) textureId );
323
380
return pigeonResult ;
324
381
}
325
382
}
@@ -427,19 +484,16 @@ private PigeonCodec() {}
427
484
protected Object readValueOfType (byte type , @ NonNull ByteBuffer buffer ) {
428
485
switch (type ) {
429
486
case (byte ) 129 :
430
- {
431
- Object value = readValue (buffer );
432
- return value == null ? null : PlatformVideoViewType .values ()[((Long ) value ).intValue ()];
433
- }
434
- case (byte ) 130 :
435
487
{
436
488
Object value = readValue (buffer );
437
489
return value == null ? null : PlatformVideoFormat .values ()[((Long ) value ).intValue ()];
438
490
}
439
- case (byte ) 131 :
491
+ case (byte ) 130 :
440
492
return PlatformVideoViewCreationParams .fromList ((ArrayList <Object >) readValue (buffer ));
493
+ case (byte ) 131 :
494
+ return CreationOptions .fromList ((ArrayList <Object >) readValue (buffer ));
441
495
case (byte ) 132 :
442
- return CreateMessage .fromList ((ArrayList <Object >) readValue (buffer ));
496
+ return TexturePlayerIds .fromList ((ArrayList <Object >) readValue (buffer ));
443
497
case (byte ) 133 :
444
498
return PlaybackState .fromList ((ArrayList <Object >) readValue (buffer ));
445
499
default :
@@ -449,18 +503,18 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {
449
503
450
504
@ Override
451
505
protected void writeValue (@ NonNull ByteArrayOutputStream stream , Object value ) {
452
- if (value instanceof PlatformVideoViewType ) {
506
+ if (value instanceof PlatformVideoFormat ) {
453
507
stream .write (129 );
454
- writeValue (stream , value == null ? null : ((PlatformVideoViewType ) value ).index );
455
- } else if (value instanceof PlatformVideoFormat ) {
456
- stream .write (130 );
457
508
writeValue (stream , value == null ? null : ((PlatformVideoFormat ) value ).index );
458
509
} else if (value instanceof PlatformVideoViewCreationParams ) {
459
- stream .write (131 );
510
+ stream .write (130 );
460
511
writeValue (stream , ((PlatformVideoViewCreationParams ) value ).toList ());
461
- } else if (value instanceof CreateMessage ) {
512
+ } else if (value instanceof CreationOptions ) {
513
+ stream .write (131 );
514
+ writeValue (stream , ((CreationOptions ) value ).toList ());
515
+ } else if (value instanceof TexturePlayerIds ) {
462
516
stream .write (132 );
463
- writeValue (stream , ((CreateMessage ) value ).toList ());
517
+ writeValue (stream , ((TexturePlayerIds ) value ).toList ());
464
518
} else if (value instanceof PlaybackState ) {
465
519
stream .write (133 );
466
520
writeValue (stream , ((PlaybackState ) value ).toList ());
@@ -476,7 +530,10 @@ public interface AndroidVideoPlayerApi {
476
530
void initialize ();
477
531
478
532
@ NonNull
479
- Long create (@ NonNull CreateMessage msg );
533
+ Long createForPlatformView (@ NonNull CreationOptions options );
534
+
535
+ @ NonNull
536
+ TexturePlayerIds createForTextureView (@ NonNull CreationOptions options );
480
537
481
538
void dispose (@ NonNull Long playerId );
482
539
@@ -530,17 +587,42 @@ static void setUp(
530
587
BasicMessageChannel <Object > channel =
531
588
new BasicMessageChannel <>(
532
589
binaryMessenger ,
533
- "dev.flutter.pigeon.video_player_android.AndroidVideoPlayerApi.create"
590
+ "dev.flutter.pigeon.video_player_android.AndroidVideoPlayerApi.createForPlatformView"
591
+ + messageChannelSuffix ,
592
+ getCodec ());
593
+ if (api != null ) {
594
+ channel .setMessageHandler (
595
+ (message , reply ) -> {
596
+ ArrayList <Object > wrapped = new ArrayList <>();
597
+ ArrayList <Object > args = (ArrayList <Object >) message ;
598
+ CreationOptions optionsArg = (CreationOptions ) args .get (0 );
599
+ try {
600
+ Long output = api .createForPlatformView (optionsArg );
601
+ wrapped .add (0 , output );
602
+ } catch (Throwable exception ) {
603
+ wrapped = wrapError (exception );
604
+ }
605
+ reply .reply (wrapped );
606
+ });
607
+ } else {
608
+ channel .setMessageHandler (null );
609
+ }
610
+ }
611
+ {
612
+ BasicMessageChannel <Object > channel =
613
+ new BasicMessageChannel <>(
614
+ binaryMessenger ,
615
+ "dev.flutter.pigeon.video_player_android.AndroidVideoPlayerApi.createForTextureView"
534
616
+ messageChannelSuffix ,
535
617
getCodec ());
536
618
if (api != null ) {
537
619
channel .setMessageHandler (
538
620
(message , reply ) -> {
539
621
ArrayList <Object > wrapped = new ArrayList <>();
540
622
ArrayList <Object > args = (ArrayList <Object >) message ;
541
- CreateMessage msgArg = (CreateMessage ) args .get (0 );
623
+ CreationOptions optionsArg = (CreationOptions ) args .get (0 );
542
624
try {
543
- Long output = api .create ( msgArg );
625
+ TexturePlayerIds output = api .createForTextureView ( optionsArg );
544
626
wrapped .add (0 , output );
545
627
} catch (Throwable exception ) {
546
628
wrapped = wrapError (exception );
0 commit comments