diff --git a/android/src/main/java/com/gianlucaparadise/flutter_cast_framework/PlatformBridgeApis.java b/android/src/main/java/com/gianlucaparadise/flutter_cast_framework/PlatformBridgeApis.java index 6630e92..470caf6 100644 --- a/android/src/main/java/com/gianlucaparadise/flutter_cast_framework/PlatformBridgeApis.java +++ b/android/src/main/java/com/gianlucaparadise/flutter_cast_framework/PlatformBridgeApis.java @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v3.1.0), do not edit directly. +// Autogenerated from Pigeon (v9.0.7), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.gianlucaparadise.flutter_cast_framework; @@ -12,156 +12,257 @@ import io.flutter.plugin.common.MessageCodec; import io.flutter.plugin.common.StandardMessageCodec; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.HashMap; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) public class PlatformBridgeApis { + @NonNull + private static ArrayList wrapError(@NonNull Throwable exception) { + ArrayList errorList = new ArrayList(3); + errorList.add(exception.toString()); + errorList.add(exception.getClass().getSimpleName()); + errorList.add( + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + return errorList; + } + /** Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaInfo */ public enum StreamType { - invalid(0), - none(1), - buffered(2), - live(3); + /** An invalid (unknown) stream type. */ + INVALID(0), + /** A stream type of "none". */ + NONE(1), + /** A buffered stream type. */ + BUFFERED(2), + /** A live stream type. */ + LIVE(3); + + private final int index; - private int index; private StreamType(final int index) { this.index = index; } } + /** Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata */ public enum MediaType { - generic(0), - movie(1), - tvShow(2), - musicTrack(3), - photo(4), - audiobookChapter(5), - user(6); + /** A media type representing generic media content. */ + GENERIC(0), + /** A media type representing a movie. */ + MOVIE(1), + /** A media type representing an TV show. */ + TV_SHOW(2), + /** A media type representing a music track. */ + MUSIC_TRACK(3), + /** A media type representing a photo. */ + PHOTO(4), + /** A media type representing an audiobook chapter. */ + AUDIOBOOK_CHAPTER(5), + /** The smallest media type value that can be assigned for application-defined media types. */ + USER(6); + + private final int index; - private int index; private MediaType(final int index) { this.index = index; } } + /** Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata */ public enum MediaMetadataKey { - albumArtist(0), - albumTitle(1), - artist(2), - bookTitle(3), - broadcastDate(4), - chapterNumber(5), - chapterTitle(6), - composer(7), - creationDate(8), - discNumber(9), - episodeNumber(10), - height(11), - locationLatitude(12), - locationLongitude(13), - locationName(14), - queueItemId(15), - releaseDate(16), - seasonNumber(17), - sectionDuration(18), - sectionStartAbsoluteTime(19), - sectionStartTimeInContainer(20), - sectionStartTimeInMedia(21), - seriesTitle(22), - studio(23), - subtitle(24), - title(25), - trackNumber(26), - width(27); + /** String key: Album artist. */ + ALBUM_ARTIST(0), + /** String key: Album title. */ + ALBUM_TITLE(1), + /** String key: Artist. */ + ARTIST(2), + /** String key: Audiobook title. */ + BOOK_TITLE(3), + /** String key: Broadcast date. */ + BROADCAST_DATE(4), + /** String key: Chapter number. */ + CHAPTER_NUMBER(5), + /** String key: Chapter title. */ + CHAPTER_TITLE(6), + /** String key: Composer. */ + COMPOSER(7), + /** String key: Creation date. */ + CREATION_DATE(8), + /** Integer key: Disc number. */ + DISC_NUMBER(9), + /** Integer key: Episode number. */ + EPISODE_NUMBER(10), + /** Integer key: Height. */ + HEIGHT(11), + /** Double key: Location latitude. */ + LOCATION_LATITUDE(12), + /** Double key: Location longitude. */ + LOCATION_LONGITUDE(13), + /** String key: Location name. */ + LOCATION_NAME(14), + /** Int key: Queue item ID. */ + QUEUE_ITEM_ID(15), + /** String key: Release date. */ + RELEASE_DATE(16), + /** Integer key: Season number. */ + SEASON_NUMBER(17), + /** Time key in milliseconds: section duration. */ + SECTION_DURATION(18), + /** Time key in milliseconds: section start absolute time. */ + SECTION_START_ABSOLUTE_TIME(19), + /** Time key in milliseconds: section start time in the container. */ + SECTION_START_TIME_IN_CONTAINER(20), + /** Time key in milliseconds: section start time in media item. */ + SECTION_START_TIME_IN_MEDIA(21), + /** String key: Series title. */ + SERIES_TITLE(22), + /** String key: Studio. */ + STUDIO(23), + /** String key: Subtitle. */ + SUBTITLE(24), + /** String key: Title. */ + TITLE(25), + /** Integer key: Track number. */ + TRACK_NUMBER(26), + /** Integer key: Width. */ + WIDTH(27); + + private final int index; - private int index; private MediaMetadataKey(final int index) { this.index = index; } } + /** Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack */ public enum TrackType { - unknown(0), - text(1), - audio(2), - video(3); + /** A media track type indicating an unknown track type. */ + UNKNOWN(0), + /** A media track type indicating a text track. */ + TEXT(1), + /** A media track type indicating an audio track. */ + AUDIO(2), + /** A media track type indicating a video track. */ + VIDEO(3); + + private final int index; - private int index; private TrackType(final int index) { this.index = index; } } + /** Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack */ public enum TrackSubtype { - unknown(0), - none(1), - subtitles(2), - captions(3), - descriptions(4), - chapters(5), - metadata(6); + /** A media track subtype indicating an unknown subtype. */ + UNKNOWN(0), + /** A media track subtype indicating no subtype. */ + NONE(1), + /** A media track subtype indicating subtitles. */ + SUBTITLES(2), + /** A media track subtype indicating closed captions. */ + CAPTIONS(3), + /** A media track subtype indicating descriptions. */ + DESCRIPTIONS(4), + /** A media track subtype indicating chapters. */ + CHAPTERS(5), + /** A media track subtype indicating metadata. */ + METADATA(6); + + private final int index; - private int index; private TrackSubtype(final int index) { this.index = index; } } + /** State of the remote media player */ public enum PlayerState { - unknown(0), - idle(1), - playing(2), - paused(3), - buffering(4), - loading(5); + /** Constant indicating unknown player state. */ + UNKNOWN(0), + /** Constant indicating that the media player is idle. */ + IDLE(1), + /** Constant indicating that the media player is playing. */ + PLAYING(2), + /** Constant indicating that the media player is paused. */ + PAUSED(3), + /** Constant indicating that the media player is buffering. */ + BUFFERING(4), + /** Constant indicating that the media player is loading. */ + LOADING(5); + + private final int index; - private int index; private PlayerState(final int index) { this.index = index; } } - /** Generated class from Pigeon that represents data sent in messages. */ - public static class MediaLoadRequestData { + /** + * Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaLoadRequestData + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class MediaLoadRequestData { private @Nullable Boolean shouldAutoplay; - public @Nullable Boolean getShouldAutoplay() { return shouldAutoplay; } + + public @Nullable Boolean getShouldAutoplay() { + return shouldAutoplay; + } + public void setShouldAutoplay(@Nullable Boolean setterArg) { this.shouldAutoplay = setterArg; } private @Nullable Long currentTime; - public @Nullable Long getCurrentTime() { return currentTime; } + + public @Nullable Long getCurrentTime() { + return currentTime; + } + public void setCurrentTime(@Nullable Long setterArg) { this.currentTime = setterArg; } private @Nullable MediaInfo mediaInfo; - public @Nullable MediaInfo getMediaInfo() { return mediaInfo; } + + public @Nullable MediaInfo getMediaInfo() { + return mediaInfo; + } + public void setMediaInfo(@Nullable MediaInfo setterArg) { this.mediaInfo = setterArg; } public static final class Builder { + private @Nullable Boolean shouldAutoplay; + public @NonNull Builder setShouldAutoplay(@Nullable Boolean setterArg) { this.shouldAutoplay = setterArg; return this; } + private @Nullable Long currentTime; + public @NonNull Builder setCurrentTime(@Nullable Long setterArg) { this.currentTime = setterArg; return this; } + private @Nullable MediaInfo mediaInfo; + public @NonNull Builder setMediaInfo(@Nullable MediaInfo setterArg) { this.mediaInfo = setterArg; return this; } + public @NonNull MediaLoadRequestData build() { MediaLoadRequestData pigeonReturn = new MediaLoadRequestData(); pigeonReturn.setShouldAutoplay(shouldAutoplay); @@ -170,116 +271,173 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("shouldAutoplay", shouldAutoplay); - toMapResult.put("currentTime", currentTime); - toMapResult.put("mediaInfo", (mediaInfo == null) ? null : mediaInfo.toMap()); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(3); + toListResult.add(shouldAutoplay); + toListResult.add(currentTime); + toListResult.add((mediaInfo == null) ? null : mediaInfo.toList()); + return toListResult; } - static @NonNull MediaLoadRequestData fromMap(@NonNull Map map) { + + static @NonNull MediaLoadRequestData fromList(@NonNull ArrayList list) { MediaLoadRequestData pigeonResult = new MediaLoadRequestData(); - Object shouldAutoplay = map.get("shouldAutoplay"); - pigeonResult.setShouldAutoplay((Boolean)shouldAutoplay); - Object currentTime = map.get("currentTime"); - pigeonResult.setCurrentTime((currentTime == null) ? null : ((currentTime instanceof Integer) ? (Integer)currentTime : (Long)currentTime)); - Object mediaInfo = map.get("mediaInfo"); - pigeonResult.setMediaInfo((mediaInfo == null) ? null : MediaInfo.fromMap((Map)mediaInfo)); + Object shouldAutoplay = list.get(0); + pigeonResult.setShouldAutoplay((Boolean) shouldAutoplay); + Object currentTime = list.get(1); + pigeonResult.setCurrentTime((currentTime == null) ? null : ((currentTime instanceof Integer) ? (Integer) currentTime : (Long) currentTime)); + Object mediaInfo = list.get(2); + pigeonResult.setMediaInfo((mediaInfo == null) ? null : MediaInfo.fromList((ArrayList) mediaInfo)); return pigeonResult; } } - /** Generated class from Pigeon that represents data sent in messages. */ - public static class MediaInfo { + /** + * Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaInfo + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class MediaInfo { private @Nullable String contentId; - public @Nullable String getContentId() { return contentId; } + + public @Nullable String getContentId() { + return contentId; + } + public void setContentId(@Nullable String setterArg) { this.contentId = setterArg; } private @Nullable StreamType streamType; - public @Nullable StreamType getStreamType() { return streamType; } + + public @Nullable StreamType getStreamType() { + return streamType; + } + public void setStreamType(@Nullable StreamType setterArg) { this.streamType = setterArg; } private @Nullable String contentType; - public @Nullable String getContentType() { return contentType; } + + public @Nullable String getContentType() { + return contentType; + } + public void setContentType(@Nullable String setterArg) { this.contentType = setterArg; } private @Nullable MediaMetadata mediaMetadata; - public @Nullable MediaMetadata getMediaMetadata() { return mediaMetadata; } + + public @Nullable MediaMetadata getMediaMetadata() { + return mediaMetadata; + } + public void setMediaMetadata(@Nullable MediaMetadata setterArg) { this.mediaMetadata = setterArg; } private @Nullable List mediaTracks; - public @Nullable List getMediaTracks() { return mediaTracks; } + + public @Nullable List getMediaTracks() { + return mediaTracks; + } + public void setMediaTracks(@Nullable List setterArg) { this.mediaTracks = setterArg; } private @Nullable Long streamDuration; - public @Nullable Long getStreamDuration() { return streamDuration; } + + public @Nullable Long getStreamDuration() { + return streamDuration; + } + public void setStreamDuration(@Nullable Long setterArg) { this.streamDuration = setterArg; } private @Nullable List adBreakClips; - public @Nullable List getAdBreakClips() { return adBreakClips; } + + public @Nullable List getAdBreakClips() { + return adBreakClips; + } + public void setAdBreakClips(@Nullable List setterArg) { this.adBreakClips = setterArg; } + /** String containing a json object */ private @Nullable String customDataAsJson; - public @Nullable String getCustomDataAsJson() { return customDataAsJson; } + + public @Nullable String getCustomDataAsJson() { + return customDataAsJson; + } + public void setCustomDataAsJson(@Nullable String setterArg) { this.customDataAsJson = setterArg; } public static final class Builder { + private @Nullable String contentId; + public @NonNull Builder setContentId(@Nullable String setterArg) { this.contentId = setterArg; return this; } + private @Nullable StreamType streamType; + public @NonNull Builder setStreamType(@Nullable StreamType setterArg) { this.streamType = setterArg; return this; } + private @Nullable String contentType; + public @NonNull Builder setContentType(@Nullable String setterArg) { this.contentType = setterArg; return this; } + private @Nullable MediaMetadata mediaMetadata; + public @NonNull Builder setMediaMetadata(@Nullable MediaMetadata setterArg) { this.mediaMetadata = setterArg; return this; } + private @Nullable List mediaTracks; + public @NonNull Builder setMediaTracks(@Nullable List setterArg) { this.mediaTracks = setterArg; return this; } + private @Nullable Long streamDuration; + public @NonNull Builder setStreamDuration(@Nullable Long setterArg) { this.streamDuration = setterArg; return this; } + private @Nullable List adBreakClips; + public @NonNull Builder setAdBreakClips(@Nullable List setterArg) { this.adBreakClips = setterArg; return this; } + private @Nullable String customDataAsJson; + public @NonNull Builder setCustomDataAsJson(@Nullable String setterArg) { this.customDataAsJson = setterArg; return this; } + public @NonNull MediaInfo build() { MediaInfo pigeonReturn = new MediaInfo(); pigeonReturn.setContentId(contentId); @@ -293,76 +451,102 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("contentId", contentId); - toMapResult.put("streamType", streamType == null ? null : streamType.index); - toMapResult.put("contentType", contentType); - toMapResult.put("mediaMetadata", (mediaMetadata == null) ? null : mediaMetadata.toMap()); - toMapResult.put("mediaTracks", mediaTracks); - toMapResult.put("streamDuration", streamDuration); - toMapResult.put("adBreakClips", adBreakClips); - toMapResult.put("customDataAsJson", customDataAsJson); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(8); + toListResult.add(contentId); + toListResult.add(streamType == null ? null : streamType.index); + toListResult.add(contentType); + toListResult.add((mediaMetadata == null) ? null : mediaMetadata.toList()); + toListResult.add(mediaTracks); + toListResult.add(streamDuration); + toListResult.add(adBreakClips); + toListResult.add(customDataAsJson); + return toListResult; } - static @NonNull MediaInfo fromMap(@NonNull Map map) { + + static @NonNull MediaInfo fromList(@NonNull ArrayList list) { MediaInfo pigeonResult = new MediaInfo(); - Object contentId = map.get("contentId"); - pigeonResult.setContentId((String)contentId); - Object streamType = map.get("streamType"); - pigeonResult.setStreamType(streamType == null ? null : StreamType.values()[(int)streamType]); - Object contentType = map.get("contentType"); - pigeonResult.setContentType((String)contentType); - Object mediaMetadata = map.get("mediaMetadata"); - pigeonResult.setMediaMetadata((mediaMetadata == null) ? null : MediaMetadata.fromMap((Map)mediaMetadata)); - Object mediaTracks = map.get("mediaTracks"); - pigeonResult.setMediaTracks((List)mediaTracks); - Object streamDuration = map.get("streamDuration"); - pigeonResult.setStreamDuration((streamDuration == null) ? null : ((streamDuration instanceof Integer) ? (Integer)streamDuration : (Long)streamDuration)); - Object adBreakClips = map.get("adBreakClips"); - pigeonResult.setAdBreakClips((List)adBreakClips); - Object customDataAsJson = map.get("customDataAsJson"); - pigeonResult.setCustomDataAsJson((String)customDataAsJson); + Object contentId = list.get(0); + pigeonResult.setContentId((String) contentId); + Object streamType = list.get(1); + pigeonResult.setStreamType(streamType == null ? null : StreamType.values()[(int) streamType]); + Object contentType = list.get(2); + pigeonResult.setContentType((String) contentType); + Object mediaMetadata = list.get(3); + pigeonResult.setMediaMetadata((mediaMetadata == null) ? null : MediaMetadata.fromList((ArrayList) mediaMetadata)); + Object mediaTracks = list.get(4); + pigeonResult.setMediaTracks((List) mediaTracks); + Object streamDuration = list.get(5); + pigeonResult.setStreamDuration((streamDuration == null) ? null : ((streamDuration instanceof Integer) ? (Integer) streamDuration : (Long) streamDuration)); + Object adBreakClips = list.get(6); + pigeonResult.setAdBreakClips((List) adBreakClips); + Object customDataAsJson = list.get(7); + pigeonResult.setCustomDataAsJson((String) customDataAsJson); return pigeonResult; } } - /** Generated class from Pigeon that represents data sent in messages. */ - public static class MediaMetadata { + /** + * Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class MediaMetadata { private @Nullable MediaType mediaType; - public @Nullable MediaType getMediaType() { return mediaType; } + + public @Nullable MediaType getMediaType() { + return mediaType; + } + public void setMediaType(@Nullable MediaType setterArg) { this.mediaType = setterArg; } private @Nullable Map strings; - public @Nullable Map getStrings() { return strings; } + + public @Nullable Map getStrings() { + return strings; + } + public void setStrings(@Nullable Map setterArg) { this.strings = setterArg; } private @Nullable List webImages; - public @Nullable List getWebImages() { return webImages; } + + public @Nullable List getWebImages() { + return webImages; + } + public void setWebImages(@Nullable List setterArg) { this.webImages = setterArg; } public static final class Builder { + private @Nullable MediaType mediaType; + public @NonNull Builder setMediaType(@Nullable MediaType setterArg) { this.mediaType = setterArg; return this; } + private @Nullable Map strings; + public @NonNull Builder setStrings(@Nullable Map setterArg) { this.strings = setterArg; return this; } + private @Nullable List webImages; + public @NonNull Builder setWebImages(@Nullable List setterArg) { this.webImages = setterArg; return this; } + public @NonNull MediaMetadata build() { MediaMetadata pigeonReturn = new MediaMetadata(); pigeonReturn.setMediaType(mediaType); @@ -371,127 +555,185 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("mediaType", mediaType == null ? null : mediaType.index); - toMapResult.put("strings", strings); - toMapResult.put("webImages", webImages); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(3); + toListResult.add(mediaType == null ? null : mediaType.index); + toListResult.add(strings); + toListResult.add(webImages); + return toListResult; } - static @NonNull MediaMetadata fromMap(@NonNull Map map) { + + static @NonNull MediaMetadata fromList(@NonNull ArrayList list) { MediaMetadata pigeonResult = new MediaMetadata(); - Object mediaType = map.get("mediaType"); - pigeonResult.setMediaType(mediaType == null ? null : MediaType.values()[(int)mediaType]); - Object strings = map.get("strings"); - pigeonResult.setStrings((Map)strings); - Object webImages = map.get("webImages"); - pigeonResult.setWebImages((List)webImages); + Object mediaType = list.get(0); + pigeonResult.setMediaType(mediaType == null ? null : MediaType.values()[(int) mediaType]); + Object strings = list.get(1); + pigeonResult.setStrings((Map) strings); + Object webImages = list.get(2); + pigeonResult.setWebImages((List) webImages); return pigeonResult; } } - /** Generated class from Pigeon that represents data sent in messages. */ - public static class WebImage { + /** + * Docs here: https://developers.google.com/android/reference/com/google/android/gms/common/images/WebImage + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class WebImage { private @Nullable String url; - public @Nullable String getUrl() { return url; } + + public @Nullable String getUrl() { + return url; + } + public void setUrl(@Nullable String setterArg) { this.url = setterArg; } public static final class Builder { + private @Nullable String url; + public @NonNull Builder setUrl(@Nullable String setterArg) { this.url = setterArg; return this; } + public @NonNull WebImage build() { WebImage pigeonReturn = new WebImage(); pigeonReturn.setUrl(url); return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("url", url); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(1); + toListResult.add(url); + return toListResult; } - static @NonNull WebImage fromMap(@NonNull Map map) { + + static @NonNull WebImage fromList(@NonNull ArrayList list) { WebImage pigeonResult = new WebImage(); - Object url = map.get("url"); - pigeonResult.setUrl((String)url); + Object url = list.get(0); + pigeonResult.setUrl((String) url); return pigeonResult; } } - /** Generated class from Pigeon that represents data sent in messages. */ - public static class MediaTrack { + /** + * Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class MediaTrack { private @Nullable Long id; - public @Nullable Long getId() { return id; } + + public @Nullable Long getId() { + return id; + } + public void setId(@Nullable Long setterArg) { this.id = setterArg; } private @Nullable TrackType trackType; - public @Nullable TrackType getTrackType() { return trackType; } + + public @Nullable TrackType getTrackType() { + return trackType; + } + public void setTrackType(@Nullable TrackType setterArg) { this.trackType = setterArg; } private @Nullable String name; - public @Nullable String getName() { return name; } + + public @Nullable String getName() { + return name; + } + public void setName(@Nullable String setterArg) { this.name = setterArg; } private @Nullable TrackSubtype trackSubtype; - public @Nullable TrackSubtype getTrackSubtype() { return trackSubtype; } + + public @Nullable TrackSubtype getTrackSubtype() { + return trackSubtype; + } + public void setTrackSubtype(@Nullable TrackSubtype setterArg) { this.trackSubtype = setterArg; } private @Nullable String contentId; - public @Nullable String getContentId() { return contentId; } + + public @Nullable String getContentId() { + return contentId; + } + public void setContentId(@Nullable String setterArg) { this.contentId = setterArg; } private @Nullable String language; - public @Nullable String getLanguage() { return language; } + + public @Nullable String getLanguage() { + return language; + } + public void setLanguage(@Nullable String setterArg) { this.language = setterArg; } public static final class Builder { + private @Nullable Long id; + public @NonNull Builder setId(@Nullable Long setterArg) { this.id = setterArg; return this; } + private @Nullable TrackType trackType; + public @NonNull Builder setTrackType(@Nullable TrackType setterArg) { this.trackType = setterArg; return this; } + private @Nullable String name; + public @NonNull Builder setName(@Nullable String setterArg) { this.name = setterArg; return this; } + private @Nullable TrackSubtype trackSubtype; + public @NonNull Builder setTrackSubtype(@Nullable TrackSubtype setterArg) { this.trackSubtype = setterArg; return this; } + private @Nullable String contentId; + public @NonNull Builder setContentId(@Nullable String setterArg) { this.contentId = setterArg; return this; } + private @Nullable String language; + public @NonNull Builder setLanguage(@Nullable String setterArg) { this.language = setterArg; return this; } + public @NonNull MediaTrack build() { MediaTrack pigeonReturn = new MediaTrack(); pigeonReturn.setId(id); @@ -503,81 +745,109 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("id", id); - toMapResult.put("trackType", trackType == null ? null : trackType.index); - toMapResult.put("name", name); - toMapResult.put("trackSubtype", trackSubtype == null ? null : trackSubtype.index); - toMapResult.put("contentId", contentId); - toMapResult.put("language", language); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(6); + toListResult.add(id); + toListResult.add(trackType == null ? null : trackType.index); + toListResult.add(name); + toListResult.add(trackSubtype == null ? null : trackSubtype.index); + toListResult.add(contentId); + toListResult.add(language); + return toListResult; } - static @NonNull MediaTrack fromMap(@NonNull Map map) { + + static @NonNull MediaTrack fromList(@NonNull ArrayList list) { MediaTrack pigeonResult = new MediaTrack(); - Object id = map.get("id"); - pigeonResult.setId((id == null) ? null : ((id instanceof Integer) ? (Integer)id : (Long)id)); - Object trackType = map.get("trackType"); - pigeonResult.setTrackType(trackType == null ? null : TrackType.values()[(int)trackType]); - Object name = map.get("name"); - pigeonResult.setName((String)name); - Object trackSubtype = map.get("trackSubtype"); - pigeonResult.setTrackSubtype(trackSubtype == null ? null : TrackSubtype.values()[(int)trackSubtype]); - Object contentId = map.get("contentId"); - pigeonResult.setContentId((String)contentId); - Object language = map.get("language"); - pigeonResult.setLanguage((String)language); + Object id = list.get(0); + pigeonResult.setId((id == null) ? null : ((id instanceof Integer) ? (Integer) id : (Long) id)); + Object trackType = list.get(1); + pigeonResult.setTrackType(trackType == null ? null : TrackType.values()[(int) trackType]); + Object name = list.get(2); + pigeonResult.setName((String) name); + Object trackSubtype = list.get(3); + pigeonResult.setTrackSubtype(trackSubtype == null ? null : TrackSubtype.values()[(int) trackSubtype]); + Object contentId = list.get(4); + pigeonResult.setContentId((String) contentId); + Object language = list.get(5); + pigeonResult.setLanguage((String) language); return pigeonResult; } } /** Generated class from Pigeon that represents data sent in messages. */ - public static class MediaStatus { + public static final class MediaStatus { private @Nullable PlayerState playerState; - public @Nullable PlayerState getPlayerState() { return playerState; } + + public @Nullable PlayerState getPlayerState() { + return playerState; + } + public void setPlayerState(@Nullable PlayerState setterArg) { this.playerState = setterArg; } private @Nullable Boolean isPlayingAd; - public @Nullable Boolean getIsPlayingAd() { return isPlayingAd; } + + public @Nullable Boolean getIsPlayingAd() { + return isPlayingAd; + } + public void setIsPlayingAd(@Nullable Boolean setterArg) { this.isPlayingAd = setterArg; } private @Nullable MediaInfo mediaInfo; - public @Nullable MediaInfo getMediaInfo() { return mediaInfo; } + + public @Nullable MediaInfo getMediaInfo() { + return mediaInfo; + } + public void setMediaInfo(@Nullable MediaInfo setterArg) { this.mediaInfo = setterArg; } private @Nullable AdBreakStatus adBreakStatus; - public @Nullable AdBreakStatus getAdBreakStatus() { return adBreakStatus; } + + public @Nullable AdBreakStatus getAdBreakStatus() { + return adBreakStatus; + } + public void setAdBreakStatus(@Nullable AdBreakStatus setterArg) { this.adBreakStatus = setterArg; } public static final class Builder { + private @Nullable PlayerState playerState; + public @NonNull Builder setPlayerState(@Nullable PlayerState setterArg) { this.playerState = setterArg; return this; } + private @Nullable Boolean isPlayingAd; + public @NonNull Builder setIsPlayingAd(@Nullable Boolean setterArg) { this.isPlayingAd = setterArg; return this; } + private @Nullable MediaInfo mediaInfo; + public @NonNull Builder setMediaInfo(@Nullable MediaInfo setterArg) { this.mediaInfo = setterArg; return this; } + private @Nullable AdBreakStatus adBreakStatus; + public @NonNull Builder setAdBreakStatus(@Nullable AdBreakStatus setterArg) { this.adBreakStatus = setterArg; return this; } + public @NonNull MediaStatus build() { MediaStatus pigeonReturn = new MediaStatus(); pigeonReturn.setPlayerState(playerState); @@ -587,64 +857,86 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("playerState", playerState == null ? null : playerState.index); - toMapResult.put("isPlayingAd", isPlayingAd); - toMapResult.put("mediaInfo", (mediaInfo == null) ? null : mediaInfo.toMap()); - toMapResult.put("adBreakStatus", (adBreakStatus == null) ? null : adBreakStatus.toMap()); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(4); + toListResult.add(playerState == null ? null : playerState.index); + toListResult.add(isPlayingAd); + toListResult.add((mediaInfo == null) ? null : mediaInfo.toList()); + toListResult.add((adBreakStatus == null) ? null : adBreakStatus.toList()); + return toListResult; } - static @NonNull MediaStatus fromMap(@NonNull Map map) { + + static @NonNull MediaStatus fromList(@NonNull ArrayList list) { MediaStatus pigeonResult = new MediaStatus(); - Object playerState = map.get("playerState"); - pigeonResult.setPlayerState(playerState == null ? null : PlayerState.values()[(int)playerState]); - Object isPlayingAd = map.get("isPlayingAd"); - pigeonResult.setIsPlayingAd((Boolean)isPlayingAd); - Object mediaInfo = map.get("mediaInfo"); - pigeonResult.setMediaInfo((mediaInfo == null) ? null : MediaInfo.fromMap((Map)mediaInfo)); - Object adBreakStatus = map.get("adBreakStatus"); - pigeonResult.setAdBreakStatus((adBreakStatus == null) ? null : AdBreakStatus.fromMap((Map)adBreakStatus)); + Object playerState = list.get(0); + pigeonResult.setPlayerState(playerState == null ? null : PlayerState.values()[(int) playerState]); + Object isPlayingAd = list.get(1); + pigeonResult.setIsPlayingAd((Boolean) isPlayingAd); + Object mediaInfo = list.get(2); + pigeonResult.setMediaInfo((mediaInfo == null) ? null : MediaInfo.fromList((ArrayList) mediaInfo)); + Object adBreakStatus = list.get(3); + pigeonResult.setAdBreakStatus((adBreakStatus == null) ? null : AdBreakStatus.fromList((ArrayList) adBreakStatus)); return pigeonResult; } } /** Generated class from Pigeon that represents data sent in messages. */ - public static class AdBreakStatus { + public static final class AdBreakStatus { private @Nullable String adBreakId; - public @Nullable String getAdBreakId() { return adBreakId; } + + public @Nullable String getAdBreakId() { + return adBreakId; + } + public void setAdBreakId(@Nullable String setterArg) { this.adBreakId = setterArg; } private @Nullable String adBreakClipId; - public @Nullable String getAdBreakClipId() { return adBreakClipId; } + + public @Nullable String getAdBreakClipId() { + return adBreakClipId; + } + public void setAdBreakClipId(@Nullable String setterArg) { this.adBreakClipId = setterArg; } private @Nullable Long whenSkippableMs; - public @Nullable Long getWhenSkippableMs() { return whenSkippableMs; } + + public @Nullable Long getWhenSkippableMs() { + return whenSkippableMs; + } + public void setWhenSkippableMs(@Nullable Long setterArg) { this.whenSkippableMs = setterArg; } public static final class Builder { + private @Nullable String adBreakId; + public @NonNull Builder setAdBreakId(@Nullable String setterArg) { this.adBreakId = setterArg; return this; } + private @Nullable String adBreakClipId; + public @NonNull Builder setAdBreakClipId(@Nullable String setterArg) { this.adBreakClipId = setterArg; return this; } + private @Nullable Long whenSkippableMs; + public @NonNull Builder setWhenSkippableMs(@Nullable Long setterArg) { this.whenSkippableMs = setterArg; return this; } + public @NonNull AdBreakStatus build() { AdBreakStatus pigeonReturn = new AdBreakStatus(); pigeonReturn.setAdBreakId(adBreakId); @@ -653,127 +945,185 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("adBreakId", adBreakId); - toMapResult.put("adBreakClipId", adBreakClipId); - toMapResult.put("whenSkippableMs", whenSkippableMs); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(3); + toListResult.add(adBreakId); + toListResult.add(adBreakClipId); + toListResult.add(whenSkippableMs); + return toListResult; } - static @NonNull AdBreakStatus fromMap(@NonNull Map map) { + + static @NonNull AdBreakStatus fromList(@NonNull ArrayList list) { AdBreakStatus pigeonResult = new AdBreakStatus(); - Object adBreakId = map.get("adBreakId"); - pigeonResult.setAdBreakId((String)adBreakId); - Object adBreakClipId = map.get("adBreakClipId"); - pigeonResult.setAdBreakClipId((String)adBreakClipId); - Object whenSkippableMs = map.get("whenSkippableMs"); - pigeonResult.setWhenSkippableMs((whenSkippableMs == null) ? null : ((whenSkippableMs instanceof Integer) ? (Integer)whenSkippableMs : (Long)whenSkippableMs)); + Object adBreakId = list.get(0); + pigeonResult.setAdBreakId((String) adBreakId); + Object adBreakClipId = list.get(1); + pigeonResult.setAdBreakClipId((String) adBreakClipId); + Object whenSkippableMs = list.get(2); + pigeonResult.setWhenSkippableMs((whenSkippableMs == null) ? null : ((whenSkippableMs instanceof Integer) ? (Integer) whenSkippableMs : (Long) whenSkippableMs)); return pigeonResult; } } /** Generated class from Pigeon that represents data sent in messages. */ - public static class AdBreakClipInfo { + public static final class AdBreakClipInfo { private @Nullable String id; - public @Nullable String getId() { return id; } + + public @Nullable String getId() { + return id; + } + public void setId(@Nullable String setterArg) { this.id = setterArg; } private @Nullable String title; - public @Nullable String getTitle() { return title; } + + public @Nullable String getTitle() { + return title; + } + public void setTitle(@Nullable String setterArg) { this.title = setterArg; } private @Nullable String contentId; - public @Nullable String getContentId() { return contentId; } + + public @Nullable String getContentId() { + return contentId; + } + public void setContentId(@Nullable String setterArg) { this.contentId = setterArg; } private @Nullable String contentUrl; - public @Nullable String getContentUrl() { return contentUrl; } + + public @Nullable String getContentUrl() { + return contentUrl; + } + public void setContentUrl(@Nullable String setterArg) { this.contentUrl = setterArg; } private @Nullable String clickThroughUrl; - public @Nullable String getClickThroughUrl() { return clickThroughUrl; } + + public @Nullable String getClickThroughUrl() { + return clickThroughUrl; + } + public void setClickThroughUrl(@Nullable String setterArg) { this.clickThroughUrl = setterArg; } private @Nullable Long durationMs; - public @Nullable Long getDurationMs() { return durationMs; } + + public @Nullable Long getDurationMs() { + return durationMs; + } + public void setDurationMs(@Nullable Long setterArg) { this.durationMs = setterArg; } private @Nullable String imageUrl; - public @Nullable String getImageUrl() { return imageUrl; } + + public @Nullable String getImageUrl() { + return imageUrl; + } + public void setImageUrl(@Nullable String setterArg) { this.imageUrl = setterArg; } private @Nullable String mimeType; - public @Nullable String getMimeType() { return mimeType; } + + public @Nullable String getMimeType() { + return mimeType; + } + public void setMimeType(@Nullable String setterArg) { this.mimeType = setterArg; } private @Nullable Long whenSkippableMs; - public @Nullable Long getWhenSkippableMs() { return whenSkippableMs; } + + public @Nullable Long getWhenSkippableMs() { + return whenSkippableMs; + } + public void setWhenSkippableMs(@Nullable Long setterArg) { this.whenSkippableMs = setterArg; } public static final class Builder { + private @Nullable String id; + public @NonNull Builder setId(@Nullable String setterArg) { this.id = setterArg; return this; } + private @Nullable String title; + public @NonNull Builder setTitle(@Nullable String setterArg) { this.title = setterArg; return this; } + private @Nullable String contentId; + public @NonNull Builder setContentId(@Nullable String setterArg) { this.contentId = setterArg; return this; } + private @Nullable String contentUrl; + public @NonNull Builder setContentUrl(@Nullable String setterArg) { this.contentUrl = setterArg; return this; } + private @Nullable String clickThroughUrl; + public @NonNull Builder setClickThroughUrl(@Nullable String setterArg) { this.clickThroughUrl = setterArg; return this; } + private @Nullable Long durationMs; + public @NonNull Builder setDurationMs(@Nullable Long setterArg) { this.durationMs = setterArg; return this; } + private @Nullable String imageUrl; + public @NonNull Builder setImageUrl(@Nullable String setterArg) { this.imageUrl = setterArg; return this; } + private @Nullable String mimeType; + public @NonNull Builder setMimeType(@Nullable String setterArg) { this.mimeType = setterArg; return this; } + private @Nullable Long whenSkippableMs; + public @NonNull Builder setWhenSkippableMs(@Nullable Long setterArg) { this.whenSkippableMs = setterArg; return this; } + public @NonNull AdBreakClipInfo build() { AdBreakClipInfo pigeonReturn = new AdBreakClipInfo(); pigeonReturn.setId(id); @@ -788,112 +1138,152 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("id", id); - toMapResult.put("title", title); - toMapResult.put("contentId", contentId); - toMapResult.put("contentUrl", contentUrl); - toMapResult.put("clickThroughUrl", clickThroughUrl); - toMapResult.put("durationMs", durationMs); - toMapResult.put("imageUrl", imageUrl); - toMapResult.put("mimeType", mimeType); - toMapResult.put("whenSkippableMs", whenSkippableMs); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(9); + toListResult.add(id); + toListResult.add(title); + toListResult.add(contentId); + toListResult.add(contentUrl); + toListResult.add(clickThroughUrl); + toListResult.add(durationMs); + toListResult.add(imageUrl); + toListResult.add(mimeType); + toListResult.add(whenSkippableMs); + return toListResult; } - static @NonNull AdBreakClipInfo fromMap(@NonNull Map map) { + + static @NonNull AdBreakClipInfo fromList(@NonNull ArrayList list) { AdBreakClipInfo pigeonResult = new AdBreakClipInfo(); - Object id = map.get("id"); - pigeonResult.setId((String)id); - Object title = map.get("title"); - pigeonResult.setTitle((String)title); - Object contentId = map.get("contentId"); - pigeonResult.setContentId((String)contentId); - Object contentUrl = map.get("contentUrl"); - pigeonResult.setContentUrl((String)contentUrl); - Object clickThroughUrl = map.get("clickThroughUrl"); - pigeonResult.setClickThroughUrl((String)clickThroughUrl); - Object durationMs = map.get("durationMs"); - pigeonResult.setDurationMs((durationMs == null) ? null : ((durationMs instanceof Integer) ? (Integer)durationMs : (Long)durationMs)); - Object imageUrl = map.get("imageUrl"); - pigeonResult.setImageUrl((String)imageUrl); - Object mimeType = map.get("mimeType"); - pigeonResult.setMimeType((String)mimeType); - Object whenSkippableMs = map.get("whenSkippableMs"); - pigeonResult.setWhenSkippableMs((whenSkippableMs == null) ? null : ((whenSkippableMs instanceof Integer) ? (Integer)whenSkippableMs : (Long)whenSkippableMs)); + Object id = list.get(0); + pigeonResult.setId((String) id); + Object title = list.get(1); + pigeonResult.setTitle((String) title); + Object contentId = list.get(2); + pigeonResult.setContentId((String) contentId); + Object contentUrl = list.get(3); + pigeonResult.setContentUrl((String) contentUrl); + Object clickThroughUrl = list.get(4); + pigeonResult.setClickThroughUrl((String) clickThroughUrl); + Object durationMs = list.get(5); + pigeonResult.setDurationMs((durationMs == null) ? null : ((durationMs instanceof Integer) ? (Integer) durationMs : (Long) durationMs)); + Object imageUrl = list.get(6); + pigeonResult.setImageUrl((String) imageUrl); + Object mimeType = list.get(7); + pigeonResult.setMimeType((String) mimeType); + Object whenSkippableMs = list.get(8); + pigeonResult.setWhenSkippableMs((whenSkippableMs == null) ? null : ((whenSkippableMs instanceof Integer) ? (Integer) whenSkippableMs : (Long) whenSkippableMs)); return pigeonResult; } } /** Generated class from Pigeon that represents data sent in messages. */ - public static class MediaQueueItem { + public static final class MediaQueueItem { private @Nullable Long itemId; - public @Nullable Long getItemId() { return itemId; } + + public @Nullable Long getItemId() { + return itemId; + } + public void setItemId(@Nullable Long setterArg) { this.itemId = setterArg; } private @Nullable Double playbackDuration; - public @Nullable Double getPlaybackDuration() { return playbackDuration; } + + public @Nullable Double getPlaybackDuration() { + return playbackDuration; + } + public void setPlaybackDuration(@Nullable Double setterArg) { this.playbackDuration = setterArg; } private @Nullable Double startTime; - public @Nullable Double getStartTime() { return startTime; } + + public @Nullable Double getStartTime() { + return startTime; + } + public void setStartTime(@Nullable Double setterArg) { this.startTime = setterArg; } private @Nullable MediaInfo media; - public @Nullable MediaInfo getMedia() { return media; } + + public @Nullable MediaInfo getMedia() { + return media; + } + public void setMedia(@Nullable MediaInfo setterArg) { this.media = setterArg; } private @Nullable Boolean autoplay; - public @Nullable Boolean getAutoplay() { return autoplay; } + + public @Nullable Boolean getAutoplay() { + return autoplay; + } + public void setAutoplay(@Nullable Boolean setterArg) { this.autoplay = setterArg; } private @Nullable Double preloadTime; - public @Nullable Double getPreloadTime() { return preloadTime; } + + public @Nullable Double getPreloadTime() { + return preloadTime; + } + public void setPreloadTime(@Nullable Double setterArg) { this.preloadTime = setterArg; } public static final class Builder { + private @Nullable Long itemId; + public @NonNull Builder setItemId(@Nullable Long setterArg) { this.itemId = setterArg; return this; } + private @Nullable Double playbackDuration; + public @NonNull Builder setPlaybackDuration(@Nullable Double setterArg) { this.playbackDuration = setterArg; return this; } + private @Nullable Double startTime; + public @NonNull Builder setStartTime(@Nullable Double setterArg) { this.startTime = setterArg; return this; } + private @Nullable MediaInfo media; + public @NonNull Builder setMedia(@Nullable MediaInfo setterArg) { this.media = setterArg; return this; } + private @Nullable Boolean autoplay; + public @NonNull Builder setAutoplay(@Nullable Boolean setterArg) { this.autoplay = setterArg; return this; } + private @Nullable Double preloadTime; + public @NonNull Builder setPreloadTime(@Nullable Double setterArg) { this.preloadTime = setterArg; return this; } + public @NonNull MediaQueueItem build() { MediaQueueItem pigeonReturn = new MediaQueueItem(); pigeonReturn.setItemId(itemId); @@ -905,70 +1295,92 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("itemId", itemId); - toMapResult.put("playbackDuration", playbackDuration); - toMapResult.put("startTime", startTime); - toMapResult.put("media", (media == null) ? null : media.toMap()); - toMapResult.put("autoplay", autoplay); - toMapResult.put("preloadTime", preloadTime); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(6); + toListResult.add(itemId); + toListResult.add(playbackDuration); + toListResult.add(startTime); + toListResult.add((media == null) ? null : media.toList()); + toListResult.add(autoplay); + toListResult.add(preloadTime); + return toListResult; } - static @NonNull MediaQueueItem fromMap(@NonNull Map map) { + + static @NonNull MediaQueueItem fromList(@NonNull ArrayList list) { MediaQueueItem pigeonResult = new MediaQueueItem(); - Object itemId = map.get("itemId"); - pigeonResult.setItemId((itemId == null) ? null : ((itemId instanceof Integer) ? (Integer)itemId : (Long)itemId)); - Object playbackDuration = map.get("playbackDuration"); - pigeonResult.setPlaybackDuration((Double)playbackDuration); - Object startTime = map.get("startTime"); - pigeonResult.setStartTime((Double)startTime); - Object media = map.get("media"); - pigeonResult.setMedia((media == null) ? null : MediaInfo.fromMap((Map)media)); - Object autoplay = map.get("autoplay"); - pigeonResult.setAutoplay((Boolean)autoplay); - Object preloadTime = map.get("preloadTime"); - pigeonResult.setPreloadTime((Double)preloadTime); + Object itemId = list.get(0); + pigeonResult.setItemId((itemId == null) ? null : ((itemId instanceof Integer) ? (Integer) itemId : (Long) itemId)); + Object playbackDuration = list.get(1); + pigeonResult.setPlaybackDuration((Double) playbackDuration); + Object startTime = list.get(2); + pigeonResult.setStartTime((Double) startTime); + Object media = list.get(3); + pigeonResult.setMedia((media == null) ? null : MediaInfo.fromList((ArrayList) media)); + Object autoplay = list.get(4); + pigeonResult.setAutoplay((Boolean) autoplay); + Object preloadTime = list.get(5); + pigeonResult.setPreloadTime((Double) preloadTime); return pigeonResult; } } /** Generated class from Pigeon that represents data sent in messages. */ - public static class CastDevice { + public static final class CastDevice { private @Nullable String deviceId; - public @Nullable String getDeviceId() { return deviceId; } + + public @Nullable String getDeviceId() { + return deviceId; + } + public void setDeviceId(@Nullable String setterArg) { this.deviceId = setterArg; } private @Nullable String friendlyName; - public @Nullable String getFriendlyName() { return friendlyName; } + + public @Nullable String getFriendlyName() { + return friendlyName; + } + public void setFriendlyName(@Nullable String setterArg) { this.friendlyName = setterArg; } private @Nullable String modelName; - public @Nullable String getModelName() { return modelName; } + + public @Nullable String getModelName() { + return modelName; + } + public void setModelName(@Nullable String setterArg) { this.modelName = setterArg; } public static final class Builder { + private @Nullable String deviceId; + public @NonNull Builder setDeviceId(@Nullable String setterArg) { this.deviceId = setterArg; return this; } + private @Nullable String friendlyName; + public @NonNull Builder setFriendlyName(@Nullable String setterArg) { this.friendlyName = setterArg; return this; } + private @Nullable String modelName; + public @NonNull Builder setModelName(@Nullable String setterArg) { this.modelName = setterArg; return this; } + public @NonNull CastDevice build() { CastDevice pigeonReturn = new CastDevice(); pigeonReturn.setDeviceId(deviceId); @@ -977,50 +1389,66 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("deviceId", deviceId); - toMapResult.put("friendlyName", friendlyName); - toMapResult.put("modelName", modelName); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(3); + toListResult.add(deviceId); + toListResult.add(friendlyName); + toListResult.add(modelName); + return toListResult; } - static @NonNull CastDevice fromMap(@NonNull Map map) { + + static @NonNull CastDevice fromList(@NonNull ArrayList list) { CastDevice pigeonResult = new CastDevice(); - Object deviceId = map.get("deviceId"); - pigeonResult.setDeviceId((String)deviceId); - Object friendlyName = map.get("friendlyName"); - pigeonResult.setFriendlyName((String)friendlyName); - Object modelName = map.get("modelName"); - pigeonResult.setModelName((String)modelName); + Object deviceId = list.get(0); + pigeonResult.setDeviceId((String) deviceId); + Object friendlyName = list.get(1); + pigeonResult.setFriendlyName((String) friendlyName); + Object modelName = list.get(2); + pigeonResult.setModelName((String) modelName); return pigeonResult; } } /** Generated class from Pigeon that represents data sent in messages. */ - public static class CastMessage { + public static final class CastMessage { private @Nullable String namespace; - public @Nullable String getNamespace() { return namespace; } + + public @Nullable String getNamespace() { + return namespace; + } + public void setNamespace(@Nullable String setterArg) { this.namespace = setterArg; } private @Nullable String message; - public @Nullable String getMessage() { return message; } + + public @Nullable String getMessage() { + return message; + } + public void setMessage(@Nullable String setterArg) { this.message = setterArg; } public static final class Builder { + private @Nullable String namespace; + public @NonNull Builder setNamespace(@Nullable String setterArg) { this.namespace = setterArg; return this; } + private @Nullable String message; + public @NonNull Builder setMessage(@Nullable String setterArg) { this.message = setterArg; return this; } + public @NonNull CastMessage build() { CastMessage pigeonReturn = new CastMessage(); pigeonReturn.setNamespace(namespace); @@ -1028,752 +1456,816 @@ public class PlatformBridgeApis { return pigeonReturn; } } - @NonNull Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("namespace", namespace); - toMapResult.put("message", message); - return toMapResult; + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(namespace); + toListResult.add(message); + return toListResult; } - static @NonNull CastMessage fromMap(@NonNull Map map) { + + static @NonNull CastMessage fromList(@NonNull ArrayList list) { CastMessage pigeonResult = new CastMessage(); - Object namespace = map.get("namespace"); - pigeonResult.setNamespace((String)namespace); - Object message = map.get("message"); - pigeonResult.setMessage((String)message); + Object namespace = list.get(0); + pigeonResult.setNamespace((String) namespace); + Object message = list.get(1); + pigeonResult.setMessage((String) message); return pigeonResult; } } + private static class CastHostApiCodec extends StandardMessageCodec { public static final CastHostApiCodec INSTANCE = new CastHostApiCodec(); + private CastHostApiCodec() {} + @Override - protected Object readValueOfType(byte type, ByteBuffer buffer) { + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: - return AdBreakClipInfo.fromMap((Map) readValue(buffer)); - - case (byte)129: - return CastDevice.fromMap((Map) readValue(buffer)); - - case (byte)130: - return CastMessage.fromMap((Map) readValue(buffer)); - - case (byte)131: - return MediaInfo.fromMap((Map) readValue(buffer)); - - case (byte)132: - return MediaLoadRequestData.fromMap((Map) readValue(buffer)); - - case (byte)133: - return MediaMetadata.fromMap((Map) readValue(buffer)); - - case (byte)134: - return MediaQueueItem.fromMap((Map) readValue(buffer)); - - case (byte)135: - return MediaTrack.fromMap((Map) readValue(buffer)); - - case (byte)136: - return WebImage.fromMap((Map) readValue(buffer)); - - default: + case (byte) 128: + return AdBreakClipInfo.fromList((ArrayList) readValue(buffer)); + case (byte) 129: + return CastDevice.fromList((ArrayList) readValue(buffer)); + case (byte) 130: + return CastMessage.fromList((ArrayList) readValue(buffer)); + case (byte) 131: + return MediaInfo.fromList((ArrayList) readValue(buffer)); + case (byte) 132: + return MediaLoadRequestData.fromList((ArrayList) readValue(buffer)); + case (byte) 133: + return MediaMetadata.fromList((ArrayList) readValue(buffer)); + case (byte) 134: + return MediaQueueItem.fromList((ArrayList) readValue(buffer)); + case (byte) 135: + return MediaTrack.fromList((ArrayList) readValue(buffer)); + case (byte) 136: + return WebImage.fromList((ArrayList) readValue(buffer)); + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof AdBreakClipInfo) { stream.write(128); - writeValue(stream, ((AdBreakClipInfo) value).toMap()); - } else - if (value instanceof CastDevice) { + writeValue(stream, ((AdBreakClipInfo) value).toList()); + } else if (value instanceof CastDevice) { stream.write(129); - writeValue(stream, ((CastDevice) value).toMap()); - } else - if (value instanceof CastMessage) { + writeValue(stream, ((CastDevice) value).toList()); + } else if (value instanceof CastMessage) { stream.write(130); - writeValue(stream, ((CastMessage) value).toMap()); - } else - if (value instanceof MediaInfo) { + writeValue(stream, ((CastMessage) value).toList()); + } else if (value instanceof MediaInfo) { stream.write(131); - writeValue(stream, ((MediaInfo) value).toMap()); - } else - if (value instanceof MediaLoadRequestData) { + writeValue(stream, ((MediaInfo) value).toList()); + } else if (value instanceof MediaLoadRequestData) { stream.write(132); - writeValue(stream, ((MediaLoadRequestData) value).toMap()); - } else - if (value instanceof MediaMetadata) { + writeValue(stream, ((MediaLoadRequestData) value).toList()); + } else if (value instanceof MediaMetadata) { stream.write(133); - writeValue(stream, ((MediaMetadata) value).toMap()); - } else - if (value instanceof MediaQueueItem) { + writeValue(stream, ((MediaMetadata) value).toList()); + } else if (value instanceof MediaQueueItem) { stream.write(134); - writeValue(stream, ((MediaQueueItem) value).toMap()); - } else - if (value instanceof MediaTrack) { + writeValue(stream, ((MediaQueueItem) value).toList()); + } else if (value instanceof MediaTrack) { stream.write(135); - writeValue(stream, ((MediaTrack) value).toMap()); - } else - if (value instanceof WebImage) { + writeValue(stream, ((MediaTrack) value).toList()); + } else if (value instanceof WebImage) { stream.write(136); - writeValue(stream, ((WebImage) value).toMap()); - } else -{ + writeValue(stream, ((WebImage) value).toList()); + } else { super.writeValue(stream, value); } } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/ + /** + * APIs for Flutter-to-Host comunication + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ public interface CastHostApi { + void sendMessage(@NonNull CastMessage message); + void showCastDialog(); + void setMute(@NonNull Boolean muted); - @NonNull CastDevice getCastDevice(); + + @NonNull + CastDevice getCastDevice(); + void loadMediaLoadRequestData(@NonNull MediaLoadRequestData request); - @NonNull MediaInfo getMediaInfo(); + + @NonNull + MediaInfo getMediaInfo(); + void play(); + void pause(); + void stop(); + void showTracksChooserDialog(); + void skipAd(); + void queueAppendItem(@NonNull MediaQueueItem item); + void queueNextItem(); + void queuePrevItem(); - @NonNull Long getQueueItemCount(); - @NonNull MediaQueueItem getQueueItemAtIndex(@NonNull Long index); + + @NonNull + Long getQueueItemCount(); + + @NonNull + MediaQueueItem getQueueItemAtIndex(@NonNull Long index); /** The codec used by CastHostApi. */ static MessageCodec getCodec() { return CastHostApiCodec.INSTANCE; } - - /** Sets up an instance of `CastHostApi` to handle messages through the `binaryMessenger`. */ + /**Sets up an instance of `CastHostApi` to handle messages through the `binaryMessenger`. */ static void setup(BinaryMessenger binaryMessenger, CastHostApi api) { { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.sendMessage", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.sendMessage", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - ArrayList args = (ArrayList)message; - CastMessage messageArg = (CastMessage)args.get(0); - if (messageArg == null) { - throw new NullPointerException("messageArg unexpectedly null."); - } - api.sendMessage(messageArg); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + CastMessage messageArg = (CastMessage) args.get(0); + if (messageArg == null) { + throw new NullPointerException("messageArg unexpectedly null."); + } + api.sendMessage(messageArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.showCastDialog", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.showCastDialog", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.showCastDialog(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.showCastDialog(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.setMute", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.setMute", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - ArrayList args = (ArrayList)message; - Boolean mutedArg = (Boolean)args.get(0); - if (mutedArg == null) { - throw new NullPointerException("mutedArg unexpectedly null."); - } - api.setMute(mutedArg); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Boolean mutedArg = (Boolean) args.get(0); + if (mutedArg == null) { + throw new NullPointerException("mutedArg unexpectedly null."); + } + api.setMute(mutedArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.getCastDevice", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.getCastDevice", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - CastDevice output = api.getCastDevice(); - wrapped.put("result", output); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + CastDevice output = api.getCastDevice(); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - ArrayList args = (ArrayList)message; - MediaLoadRequestData requestArg = (MediaLoadRequestData)args.get(0); - if (requestArg == null) { - throw new NullPointerException("requestArg unexpectedly null."); - } - api.loadMediaLoadRequestData(requestArg); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + MediaLoadRequestData requestArg = (MediaLoadRequestData) args.get(0); + if (requestArg == null) { + throw new NullPointerException("requestArg unexpectedly null."); + } + api.loadMediaLoadRequestData(requestArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.getMediaInfo", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.getMediaInfo", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - MediaInfo output = api.getMediaInfo(); - wrapped.put("result", output); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + MediaInfo output = api.getMediaInfo(); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.play", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.play", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.play(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.play(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.pause", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.pause", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.pause(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.pause(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.stop", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.stop", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.stop(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.stop(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.showTracksChooserDialog", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.showTracksChooserDialog", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.showTracksChooserDialog(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.showTracksChooserDialog(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.skipAd", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.skipAd", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.skipAd(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.skipAd(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.queueAppendItem", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.queueAppendItem", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - ArrayList args = (ArrayList)message; - MediaQueueItem itemArg = (MediaQueueItem)args.get(0); - if (itemArg == null) { - throw new NullPointerException("itemArg unexpectedly null."); - } - api.queueAppendItem(itemArg); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + MediaQueueItem itemArg = (MediaQueueItem) args.get(0); + if (itemArg == null) { + throw new NullPointerException("itemArg unexpectedly null."); + } + api.queueAppendItem(itemArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.queueNextItem", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.queueNextItem", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.queueNextItem(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.queueNextItem(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.queuePrevItem", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.queuePrevItem", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - api.queuePrevItem(); - wrapped.put("result", null); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.queuePrevItem(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.getQueueItemCount", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.getQueueItemCount", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - Long output = api.getQueueItemCount(); - wrapped.put("result", output); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + Long output = api.getQueueItemCount(); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.getQueueItemAtIndex", getCodec()); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastHostApi.getQueueItemAtIndex", getCodec()); if (api != null) { - channel.setMessageHandler((message, reply) -> { - Map wrapped = new HashMap<>(); - try { - ArrayList args = (ArrayList)message; - Number indexArg = (Number)args.get(0); - if (indexArg == null) { - throw new NullPointerException("indexArg unexpectedly null."); - } - MediaQueueItem output = api.getQueueItemAtIndex((indexArg == null) ? null : indexArg.longValue()); - wrapped.put("result", output); - } - catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + Number indexArg = (Number) args.get(0); + if (indexArg == null) { + throw new NullPointerException("indexArg unexpectedly null."); + } + MediaQueueItem output = api.getQueueItemAtIndex((indexArg == null) ? null : indexArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); } else { channel.setMessageHandler(null); } } } } + private static class CastFlutterApiCodec extends StandardMessageCodec { public static final CastFlutterApiCodec INSTANCE = new CastFlutterApiCodec(); + private CastFlutterApiCodec() {} + @Override - protected Object readValueOfType(byte type, ByteBuffer buffer) { + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte)128: - return AdBreakClipInfo.fromMap((Map) readValue(buffer)); - - case (byte)129: - return AdBreakStatus.fromMap((Map) readValue(buffer)); - - case (byte)130: - return CastMessage.fromMap((Map) readValue(buffer)); - - case (byte)131: - return MediaInfo.fromMap((Map) readValue(buffer)); - - case (byte)132: - return MediaMetadata.fromMap((Map) readValue(buffer)); - - case (byte)133: - return MediaStatus.fromMap((Map) readValue(buffer)); - - case (byte)134: - return MediaTrack.fromMap((Map) readValue(buffer)); - - case (byte)135: - return WebImage.fromMap((Map) readValue(buffer)); - - default: + case (byte) 128: + return AdBreakClipInfo.fromList((ArrayList) readValue(buffer)); + case (byte) 129: + return AdBreakStatus.fromList((ArrayList) readValue(buffer)); + case (byte) 130: + return CastMessage.fromList((ArrayList) readValue(buffer)); + case (byte) 131: + return MediaInfo.fromList((ArrayList) readValue(buffer)); + case (byte) 132: + return MediaMetadata.fromList((ArrayList) readValue(buffer)); + case (byte) 133: + return MediaStatus.fromList((ArrayList) readValue(buffer)); + case (byte) 134: + return MediaTrack.fromList((ArrayList) readValue(buffer)); + case (byte) 135: + return WebImage.fromList((ArrayList) readValue(buffer)); + default: return super.readValueOfType(type, buffer); - } } + @Override - protected void writeValue(ByteArrayOutputStream stream, Object value) { + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof AdBreakClipInfo) { stream.write(128); - writeValue(stream, ((AdBreakClipInfo) value).toMap()); - } else - if (value instanceof AdBreakStatus) { + writeValue(stream, ((AdBreakClipInfo) value).toList()); + } else if (value instanceof AdBreakStatus) { stream.write(129); - writeValue(stream, ((AdBreakStatus) value).toMap()); - } else - if (value instanceof CastMessage) { + writeValue(stream, ((AdBreakStatus) value).toList()); + } else if (value instanceof CastMessage) { stream.write(130); - writeValue(stream, ((CastMessage) value).toMap()); - } else - if (value instanceof MediaInfo) { + writeValue(stream, ((CastMessage) value).toList()); + } else if (value instanceof MediaInfo) { stream.write(131); - writeValue(stream, ((MediaInfo) value).toMap()); - } else - if (value instanceof MediaMetadata) { + writeValue(stream, ((MediaInfo) value).toList()); + } else if (value instanceof MediaMetadata) { stream.write(132); - writeValue(stream, ((MediaMetadata) value).toMap()); - } else - if (value instanceof MediaStatus) { + writeValue(stream, ((MediaMetadata) value).toList()); + } else if (value instanceof MediaStatus) { stream.write(133); - writeValue(stream, ((MediaStatus) value).toMap()); - } else - if (value instanceof MediaTrack) { + writeValue(stream, ((MediaStatus) value).toList()); + } else if (value instanceof MediaTrack) { stream.write(134); - writeValue(stream, ((MediaTrack) value).toMap()); - } else - if (value instanceof WebImage) { + writeValue(stream, ((MediaTrack) value).toList()); + } else if (value instanceof WebImage) { stream.write(135); - writeValue(stream, ((WebImage) value).toMap()); - } else -{ + writeValue(stream, ((WebImage) value).toList()); + } else { super.writeValue(stream, value); } } } - /** Generated class from Pigeon that represents Flutter messages that can be called from Java.*/ + /** + * APIs for Host-to-Flutter comunication + * + * Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ public static class CastFlutterApi { private final BinaryMessenger binaryMessenger; - public CastFlutterApi(BinaryMessenger argBinaryMessenger){ + + public CastFlutterApi(BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - public interface Reply { + + /** Public interface for sending reply. */ public interface Reply { void reply(T reply); } + /** The codec used by CastFlutterApi. */ static MessageCodec getCodec() { return CastFlutterApiCodec.INSTANCE; } - public void getSessionMessageNamespaces(Reply> callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.getSessionMessageNamespaces", getCodec()); - channel.send(null, channelReply -> { - @SuppressWarnings("ConstantConditions") - List output = (List)channelReply; - callback.reply(output); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.getSessionMessageNamespaces", getCodec()); + channel.send( + null, + channelReply -> { + @SuppressWarnings("ConstantConditions") + List output = (List) channelReply; + callback.reply(output); + }); } public void onCastStateChanged(@NonNull Long castStateArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onCastStateChanged", getCodec()); - channel.send(new ArrayList(Arrays.asList(castStateArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onCastStateChanged", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(castStateArg)), + channelReply -> callback.reply(null)); } public void onMessageReceived(@NonNull CastMessage messageArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMessageReceived", getCodec()); - channel.send(new ArrayList(Arrays.asList(messageArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMessageReceived", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(messageArg)), + channelReply -> callback.reply(null)); } public void onSessionStarting(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStarting", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStarting", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionStarted(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStarted", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStarted", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionStartFailed(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionEnding(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionEnding", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionEnding", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionEnded(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionEnded", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionEnded", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionResuming(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResuming", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResuming", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionResumed(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResumed", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResumed", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionResumeFailed(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSessionSuspended(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionSuspended", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSessionSuspended", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onStatusUpdated(@NonNull MediaStatus mediaStatusArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onStatusUpdated", getCodec()); - channel.send(new ArrayList(Arrays.asList(mediaStatusArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onStatusUpdated", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(mediaStatusArg)), + channelReply -> callback.reply(null)); } public void onMetadataUpdated(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onQueueStatusUpdated(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onPreloadStatusUpdated(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onSendingRemoteMediaRequest(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onAdBreakStatusUpdated(@NonNull MediaStatus mediaStatusArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated", getCodec()); - channel.send(new ArrayList(Arrays.asList(mediaStatusArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(mediaStatusArg)), + channelReply -> callback.reply(null)); } public void onMediaError(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMediaError", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMediaError", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void onProgressUpdated(@NonNull Long progressMsArg, @NonNull Long durationMsArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onProgressUpdated", getCodec()); - channel.send(new ArrayList(Arrays.asList(progressMsArg, durationMsArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onProgressUpdated", getCodec()); + channel.send( + new ArrayList(Arrays.asList(progressMsArg, durationMsArg)), + channelReply -> callback.reply(null)); } public void onAdBreakClipProgressUpdated(@NonNull String adBreakIdArg, @NonNull String adBreakClipIdArg, @NonNull Long progressMsArg, @NonNull Long durationMsArg, @NonNull Long whenSkippableMsArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated", getCodec()); - channel.send(new ArrayList(Arrays.asList(adBreakIdArg, adBreakClipIdArg, progressMsArg, durationMsArg, whenSkippableMsArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated", getCodec()); + channel.send( + new ArrayList(Arrays.asList(adBreakIdArg, adBreakClipIdArg, progressMsArg, durationMsArg, whenSkippableMsArg)), + channelReply -> callback.reply(null)); } public void itemsInsertedInRange(@NonNull Long insertIndexArg, @NonNull Long insertCountArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange", getCodec()); - channel.send(new ArrayList(Arrays.asList(insertIndexArg, insertCountArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange", getCodec()); + channel.send( + new ArrayList(Arrays.asList(insertIndexArg, insertCountArg)), + channelReply -> callback.reply(null)); } public void itemsReloaded(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsReloaded", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsReloaded", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void itemsRemovedAtIndexes(@NonNull List indexesArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes", getCodec()); - channel.send(new ArrayList(Arrays.asList(indexesArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(indexesArg)), + channelReply -> callback.reply(null)); } public void itemsReorderedAtIndexes(@NonNull List indexesArg, @NonNull Long insertBeforeIndexArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes", getCodec()); - channel.send(new ArrayList(Arrays.asList(indexesArg, insertBeforeIndexArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes", getCodec()); + channel.send( + new ArrayList(Arrays.asList(indexesArg, insertBeforeIndexArg)), + channelReply -> callback.reply(null)); } public void itemsUpdatedAtIndexes(@NonNull List indexesArg, Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes", getCodec()); - channel.send(new ArrayList(Arrays.asList(indexesArg)), channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(indexesArg)), + channelReply -> callback.reply(null)); } public void mediaQueueChanged(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.mediaQueueChanged", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.mediaQueueChanged", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } public void mediaQueueWillChange(Reply callback) { BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.mediaQueueWillChange", getCodec()); - channel.send(null, channelReply -> { - callback.reply(null); - }); + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.mediaQueueWillChange", getCodec()); + channel.send( + null, + channelReply -> callback.reply(null)); } } - private static Map wrapError(Throwable exception) { - Map errorMap = new HashMap<>(); - errorMap.put("message", exception.toString()); - errorMap.put("code", exception.getClass().getSimpleName()); - errorMap.put("details", "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); - return errorMap; - } } diff --git a/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/FlutterMediaLoadRequestDataHelper.kt b/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/FlutterMediaLoadRequestDataHelper.kt index 249d964..a5f9b27 100644 --- a/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/FlutterMediaLoadRequestDataHelper.kt +++ b/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/FlutterMediaLoadRequestDataHelper.kt @@ -27,13 +27,13 @@ fun getFlutterAdBreakStatus(adBreakStatus: AdBreakStatus?): PlatformBridgeApis.A fun getFlutterPlayerState(playerStateRaw: Int?): PlatformBridgeApis.PlayerState { return when (playerStateRaw) { - MediaStatus.PLAYER_STATE_UNKNOWN -> PlatformBridgeApis.PlayerState.unknown - MediaStatus.PLAYER_STATE_BUFFERING -> PlatformBridgeApis.PlayerState.buffering - MediaStatus.PLAYER_STATE_IDLE -> PlatformBridgeApis.PlayerState.idle - MediaStatus.PLAYER_STATE_LOADING -> PlatformBridgeApis.PlayerState.loading - MediaStatus.PLAYER_STATE_PAUSED -> PlatformBridgeApis.PlayerState.paused - MediaStatus.PLAYER_STATE_PLAYING -> PlatformBridgeApis.PlayerState.playing - else -> PlatformBridgeApis.PlayerState.unknown + MediaStatus.PLAYER_STATE_UNKNOWN -> PlatformBridgeApis.PlayerState.UNKNOWN + MediaStatus.PLAYER_STATE_BUFFERING -> PlatformBridgeApis.PlayerState.BUFFERING + MediaStatus.PLAYER_STATE_IDLE -> PlatformBridgeApis.PlayerState.IDLE + MediaStatus.PLAYER_STATE_LOADING -> PlatformBridgeApis.PlayerState.LOADING + MediaStatus.PLAYER_STATE_PAUSED -> PlatformBridgeApis.PlayerState.PAUSED + MediaStatus.PLAYER_STATE_PLAYING -> PlatformBridgeApis.PlayerState.PLAYING + else -> PlatformBridgeApis.PlayerState.UNKNOWN } } @@ -57,11 +57,11 @@ fun getFlutterMediaInfo(mediaInfo: MediaInfo?): PlatformBridgeApis.MediaInfo { fun getFlutterStreamType(streamType: Int?): PlatformBridgeApis.StreamType { return when (streamType) { - -1 -> PlatformBridgeApis.StreamType.invalid - 0 -> PlatformBridgeApis.StreamType.none - 1 -> PlatformBridgeApis.StreamType.buffered - 2 -> PlatformBridgeApis.StreamType.live - else -> PlatformBridgeApis.StreamType.invalid + -1 -> PlatformBridgeApis.StreamType.INVALID + 0 -> PlatformBridgeApis.StreamType.NONE + 1 -> PlatformBridgeApis.StreamType.BUFFERED + 2 -> PlatformBridgeApis.StreamType.LIVE + else -> PlatformBridgeApis.StreamType.INVALID } } @@ -107,24 +107,24 @@ fun getFlutterAdBreakClipInfo(adBreakClipInfo: AdBreakClipInfo?): PlatformBridge fun getFlutterType(type: Int?): PlatformBridgeApis.TrackType { return when (type) { - 0 -> PlatformBridgeApis.TrackType.unknown - 1 -> PlatformBridgeApis.TrackType.text - 2 -> PlatformBridgeApis.TrackType.audio - 3 -> PlatformBridgeApis.TrackType.video - else -> PlatformBridgeApis.TrackType.unknown + 0 -> PlatformBridgeApis.TrackType.UNKNOWN + 1 -> PlatformBridgeApis.TrackType.TEXT + 2 -> PlatformBridgeApis.TrackType.AUDIO + 3 -> PlatformBridgeApis.TrackType.VIDEO + else -> PlatformBridgeApis.TrackType.UNKNOWN } } fun getFlutterSubtype(subtype: Int?): PlatformBridgeApis.TrackSubtype { return when (subtype) { - -1 -> PlatformBridgeApis.TrackSubtype.unknown - 0 -> PlatformBridgeApis.TrackSubtype.none - 1 -> PlatformBridgeApis.TrackSubtype.subtitles - 2 -> PlatformBridgeApis.TrackSubtype.captions - 3 -> PlatformBridgeApis.TrackSubtype.descriptions - 4 -> PlatformBridgeApis.TrackSubtype.chapters - 5 -> PlatformBridgeApis.TrackSubtype.metadata - else -> PlatformBridgeApis.TrackSubtype.unknown + -1 -> PlatformBridgeApis.TrackSubtype.UNKNOWN + 0 -> PlatformBridgeApis.TrackSubtype.NONE + 1 -> PlatformBridgeApis.TrackSubtype.SUBTITLES + 2 -> PlatformBridgeApis.TrackSubtype.CAPTIONS + 3 -> PlatformBridgeApis.TrackSubtype.DESCRIPTIONS + 4 -> PlatformBridgeApis.TrackSubtype.CHAPTERS + 5 -> PlatformBridgeApis.TrackSubtype.METADATA + else -> PlatformBridgeApis.TrackSubtype.UNKNOWN } } @@ -150,14 +150,14 @@ fun getFlutterWebImages(images: List?): List PlatformBridgeApis.MediaType.generic - 1 -> PlatformBridgeApis.MediaType.movie - 2 -> PlatformBridgeApis.MediaType.tvShow - 3 -> PlatformBridgeApis.MediaType.musicTrack - 4 -> PlatformBridgeApis.MediaType.photo - 5 -> PlatformBridgeApis.MediaType.audiobookChapter - 100 -> PlatformBridgeApis.MediaType.user - else -> PlatformBridgeApis.MediaType.generic + 0 -> PlatformBridgeApis.MediaType.GENERIC + 1 -> PlatformBridgeApis.MediaType.MOVIE + 2 -> PlatformBridgeApis.MediaType.TV_SHOW + 3 -> PlatformBridgeApis.MediaType.MUSIC_TRACK + 4 -> PlatformBridgeApis.MediaType.PHOTO + 5 -> PlatformBridgeApis.MediaType.AUDIOBOOK_CHAPTER + 100 -> PlatformBridgeApis.MediaType.USER + else -> PlatformBridgeApis.MediaType.GENERIC } } @@ -168,34 +168,34 @@ fun getFlutterStrings(mediaMetadata: MediaMetadata?): Map { fun getFlutterMediaMetadataKey(mediaMetadataKey: String): String { return when (mediaMetadataKey) { - "com.google.android.gms.cast.metadata.ALBUM_ARTIST" -> PlatformBridgeApis.MediaMetadataKey.albumArtist.name - "com.google.android.gms.cast.metadata.ALBUM_TITLE" -> PlatformBridgeApis.MediaMetadataKey.albumTitle.name - "com.google.android.gms.cast.metadata.ARTIST" -> PlatformBridgeApis.MediaMetadataKey.artist.name - "com.google.android.gms.cast.metadata.BOOK_TITLE" -> PlatformBridgeApis.MediaMetadataKey.bookTitle.name - "com.google.android.gms.cast.metadata.BROADCAST_DATE" -> PlatformBridgeApis.MediaMetadataKey.broadcastDate.name - "com.google.android.gms.cast.metadata.CHAPTER_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.chapterNumber.name - "com.google.android.gms.cast.metadata.CHAPTER_TITLE" -> PlatformBridgeApis.MediaMetadataKey.chapterTitle.name - "com.google.android.gms.cast.metadata.COMPOSER" -> PlatformBridgeApis.MediaMetadataKey.composer.name - "com.google.android.gms.cast.metadata.CREATION_DATE" -> PlatformBridgeApis.MediaMetadataKey.creationDate.name - "com.google.android.gms.cast.metadata.DISC_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.discNumber.name - "com.google.android.gms.cast.metadata.EPISODE_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.episodeNumber.name - "com.google.android.gms.cast.metadata.HEIGHT" -> PlatformBridgeApis.MediaMetadataKey.height.name - "com.google.android.gms.cast.metadata.LOCATION_LATITUDE" -> PlatformBridgeApis.MediaMetadataKey.locationLatitude.name - "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE" -> PlatformBridgeApis.MediaMetadataKey.locationLongitude.name - "com.google.android.gms.cast.metadata.LOCATION_NAME" -> PlatformBridgeApis.MediaMetadataKey.locationName.name - "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID" -> PlatformBridgeApis.MediaMetadataKey.queueItemId.name - "com.google.android.gms.cast.metadata.RELEASE_DATE" -> PlatformBridgeApis.MediaMetadataKey.releaseDate.name - "com.google.android.gms.cast.metadata.SEASON_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.seasonNumber.name - "com.google.android.gms.cast.metadata.SECTION_DURATION" -> PlatformBridgeApis.MediaMetadataKey.sectionDuration.name - "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME" -> PlatformBridgeApis.MediaMetadataKey.sectionStartAbsoluteTime.name - "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER" -> PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInContainer.name - "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA" -> PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInMedia.name - "com.google.android.gms.cast.metadata.SERIES_TITLE" -> PlatformBridgeApis.MediaMetadataKey.seriesTitle.name - "com.google.android.gms.cast.metadata.STUDIO" -> PlatformBridgeApis.MediaMetadataKey.studio.name - "com.google.android.gms.cast.metadata.SUBTITLE" -> PlatformBridgeApis.MediaMetadataKey.subtitle.name - "com.google.android.gms.cast.metadata.TITLE" -> PlatformBridgeApis.MediaMetadataKey.title.name - "com.google.android.gms.cast.metadata.TRACK_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.trackNumber.name - "com.google.android.gms.cast.metadata.WIDTH" -> PlatformBridgeApis.MediaMetadataKey.width.name + "com.google.android.gms.cast.metadata.ALBUM_ARTIST" -> PlatformBridgeApis.MediaMetadataKey.ALBUM_ARTIST.name + "com.google.android.gms.cast.metadata.ALBUM_TITLE" -> PlatformBridgeApis.MediaMetadataKey.ALBUM_TITLE.name + "com.google.android.gms.cast.metadata.ARTIST" -> PlatformBridgeApis.MediaMetadataKey.ARTIST.name + "com.google.android.gms.cast.metadata.BOOK_TITLE" -> PlatformBridgeApis.MediaMetadataKey.BOOK_TITLE.name + "com.google.android.gms.cast.metadata.BROADCAST_DATE" -> PlatformBridgeApis.MediaMetadataKey.BROADCAST_DATE.name + "com.google.android.gms.cast.metadata.CHAPTER_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.CHAPTER_NUMBER.name + "com.google.android.gms.cast.metadata.CHAPTER_TITLE" -> PlatformBridgeApis.MediaMetadataKey.CHAPTER_TITLE.name + "com.google.android.gms.cast.metadata.COMPOSER" -> PlatformBridgeApis.MediaMetadataKey.COMPOSER.name + "com.google.android.gms.cast.metadata.CREATION_DATE" -> PlatformBridgeApis.MediaMetadataKey.CREATION_DATE.name + "com.google.android.gms.cast.metadata.DISC_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.DISC_NUMBER.name + "com.google.android.gms.cast.metadata.EPISODE_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.EPISODE_NUMBER.name + "com.google.android.gms.cast.metadata.HEIGHT" -> PlatformBridgeApis.MediaMetadataKey.HEIGHT.name + "com.google.android.gms.cast.metadata.LOCATION_LATITUDE" -> PlatformBridgeApis.MediaMetadataKey.LOCATION_LATITUDE.name + "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE" -> PlatformBridgeApis.MediaMetadataKey.LOCATION_LONGITUDE.name + "com.google.android.gms.cast.metadata.LOCATION_NAME" -> PlatformBridgeApis.MediaMetadataKey.LOCATION_NAME.name + "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID" -> PlatformBridgeApis.MediaMetadataKey.QUEUE_ITEM_ID.name + "com.google.android.gms.cast.metadata.RELEASE_DATE" -> PlatformBridgeApis.MediaMetadataKey.RELEASE_DATE.name + "com.google.android.gms.cast.metadata.SEASON_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.SEASON_NUMBER.name + "com.google.android.gms.cast.metadata.SECTION_DURATION" -> PlatformBridgeApis.MediaMetadataKey.SECTION_DURATION.name + "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME" -> PlatformBridgeApis.MediaMetadataKey.SECTION_START_ABSOLUTE_TIME.name + "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER" -> PlatformBridgeApis.MediaMetadataKey.SECTION_START_TIME_IN_CONTAINER.name + "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA" -> PlatformBridgeApis.MediaMetadataKey.SECTION_START_TIME_IN_MEDIA.name + "com.google.android.gms.cast.metadata.SERIES_TITLE" -> PlatformBridgeApis.MediaMetadataKey.SERIES_TITLE.name + "com.google.android.gms.cast.metadata.STUDIO" -> PlatformBridgeApis.MediaMetadataKey.STUDIO.name + "com.google.android.gms.cast.metadata.SUBTITLE" -> PlatformBridgeApis.MediaMetadataKey.SUBTITLE.name + "com.google.android.gms.cast.metadata.TITLE" -> PlatformBridgeApis.MediaMetadataKey.TITLE.name + "com.google.android.gms.cast.metadata.TRACK_NUMBER" -> PlatformBridgeApis.MediaMetadataKey.TRACK_NUMBER.name + "com.google.android.gms.cast.metadata.WIDTH" -> PlatformBridgeApis.MediaMetadataKey.WIDTH.name else -> mediaMetadataKey } } diff --git a/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/HostMediaLoadRequestDataHelper.kt b/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/HostMediaLoadRequestDataHelper.kt index 665c3cc..eba95b0 100644 --- a/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/HostMediaLoadRequestDataHelper.kt +++ b/android/src/main/kotlin/com/gianlucaparadise/flutter_cast_framework/media/HostMediaLoadRequestDataHelper.kt @@ -47,10 +47,10 @@ fun getMediaInfo(mediaInfo: PlatformBridgeApis.MediaInfo?): MediaInfo? { fun getStreamType(streamType: PlatformBridgeApis.StreamType): Int { return when (streamType) { - PlatformBridgeApis.StreamType.invalid -> -1 - PlatformBridgeApis.StreamType.none -> 0 - PlatformBridgeApis.StreamType.buffered -> 1 - PlatformBridgeApis.StreamType.live -> 2 + PlatformBridgeApis.StreamType.INVALID -> -1 + PlatformBridgeApis.StreamType.NONE -> 0 + PlatformBridgeApis.StreamType.BUFFERED -> 1 + PlatformBridgeApis.StreamType.LIVE -> 2 } } @@ -77,46 +77,46 @@ fun getMediaMetadata(mediaMetadata: PlatformBridgeApis.MediaMetadata): MediaMeta fun getMediaType(mediaType: PlatformBridgeApis.MediaType): Int { return when (mediaType) { - PlatformBridgeApis.MediaType.generic -> 0 - PlatformBridgeApis.MediaType.movie -> 1 - PlatformBridgeApis.MediaType.tvShow -> 2 - PlatformBridgeApis.MediaType.musicTrack -> 3 - PlatformBridgeApis.MediaType.photo -> 4 - PlatformBridgeApis.MediaType.audiobookChapter -> 5 - PlatformBridgeApis.MediaType.user -> 100 + PlatformBridgeApis.MediaType.GENERIC -> 0 + PlatformBridgeApis.MediaType.MOVIE -> 1 + PlatformBridgeApis.MediaType.TV_SHOW -> 2 + PlatformBridgeApis.MediaType.MUSIC_TRACK -> 3 + PlatformBridgeApis.MediaType.PHOTO -> 4 + PlatformBridgeApis.MediaType.AUDIOBOOK_CHAPTER -> 5 + PlatformBridgeApis.MediaType.USER -> 100 } } fun getMediaMetadataKey(mediaMetadataKey: String): String { return when (mediaMetadataKey) { - PlatformBridgeApis.MediaMetadataKey.albumArtist.name -> "com.google.android.gms.cast.metadata.ALBUM_ARTIST" - PlatformBridgeApis.MediaMetadataKey.albumTitle.name -> "com.google.android.gms.cast.metadata.ALBUM_TITLE" - PlatformBridgeApis.MediaMetadataKey.artist.name -> "com.google.android.gms.cast.metadata.ARTIST" - PlatformBridgeApis.MediaMetadataKey.bookTitle.name -> "com.google.android.gms.cast.metadata.BOOK_TITLE" - PlatformBridgeApis.MediaMetadataKey.broadcastDate.name -> "com.google.android.gms.cast.metadata.BROADCAST_DATE" - PlatformBridgeApis.MediaMetadataKey.chapterNumber.name -> "com.google.android.gms.cast.metadata.CHAPTER_NUMBER" - PlatformBridgeApis.MediaMetadataKey.chapterTitle.name -> "com.google.android.gms.cast.metadata.CHAPTER_TITLE" - PlatformBridgeApis.MediaMetadataKey.composer.name -> "com.google.android.gms.cast.metadata.COMPOSER" - PlatformBridgeApis.MediaMetadataKey.creationDate.name -> "com.google.android.gms.cast.metadata.CREATION_DATE" - PlatformBridgeApis.MediaMetadataKey.discNumber.name -> "com.google.android.gms.cast.metadata.DISC_NUMBER" - PlatformBridgeApis.MediaMetadataKey.episodeNumber.name -> "com.google.android.gms.cast.metadata.EPISODE_NUMBER" - PlatformBridgeApis.MediaMetadataKey.height.name -> "com.google.android.gms.cast.metadata.HEIGHT" - PlatformBridgeApis.MediaMetadataKey.locationLatitude.name -> "com.google.android.gms.cast.metadata.LOCATION_LATITUDE" - PlatformBridgeApis.MediaMetadataKey.locationLongitude.name -> "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE" - PlatformBridgeApis.MediaMetadataKey.locationName.name -> "com.google.android.gms.cast.metadata.LOCATION_NAME" - PlatformBridgeApis.MediaMetadataKey.queueItemId.name -> "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID" - PlatformBridgeApis.MediaMetadataKey.releaseDate.name -> "com.google.android.gms.cast.metadata.RELEASE_DATE" - PlatformBridgeApis.MediaMetadataKey.seasonNumber.name -> "com.google.android.gms.cast.metadata.SEASON_NUMBER" - PlatformBridgeApis.MediaMetadataKey.sectionDuration.name -> "com.google.android.gms.cast.metadata.SECTION_DURATION" - PlatformBridgeApis.MediaMetadataKey.sectionStartAbsoluteTime.name -> "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME" - PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInContainer.name -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER" - PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInMedia.name -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA" - PlatformBridgeApis.MediaMetadataKey.seriesTitle.name -> "com.google.android.gms.cast.metadata.SERIES_TITLE" - PlatformBridgeApis.MediaMetadataKey.studio.name -> "com.google.android.gms.cast.metadata.STUDIO" - PlatformBridgeApis.MediaMetadataKey.subtitle.name -> "com.google.android.gms.cast.metadata.SUBTITLE" - PlatformBridgeApis.MediaMetadataKey.title.name -> "com.google.android.gms.cast.metadata.TITLE" - PlatformBridgeApis.MediaMetadataKey.trackNumber.name -> "com.google.android.gms.cast.metadata.TRACK_NUMBER" - PlatformBridgeApis.MediaMetadataKey.width.name -> "com.google.android.gms.cast.metadata.WIDTH" + PlatformBridgeApis.MediaMetadataKey.ALBUM_ARTIST.name -> "com.google.android.gms.cast.metadata.ALBUM_ARTIST" + PlatformBridgeApis.MediaMetadataKey.ALBUM_TITLE.name -> "com.google.android.gms.cast.metadata.ALBUM_TITLE" + PlatformBridgeApis.MediaMetadataKey.ARTIST.name -> "com.google.android.gms.cast.metadata.ARTIST" + PlatformBridgeApis.MediaMetadataKey.BOOK_TITLE.name -> "com.google.android.gms.cast.metadata.BOOK_TITLE" + PlatformBridgeApis.MediaMetadataKey.BROADCAST_DATE.name -> "com.google.android.gms.cast.metadata.BROADCAST_DATE" + PlatformBridgeApis.MediaMetadataKey.CHAPTER_NUMBER.name -> "com.google.android.gms.cast.metadata.CHAPTER_NUMBER" + PlatformBridgeApis.MediaMetadataKey.CHAPTER_TITLE.name -> "com.google.android.gms.cast.metadata.CHAPTER_TITLE" + PlatformBridgeApis.MediaMetadataKey.COMPOSER.name -> "com.google.android.gms.cast.metadata.COMPOSER" + PlatformBridgeApis.MediaMetadataKey.CREATION_DATE.name -> "com.google.android.gms.cast.metadata.CREATION_DATE" + PlatformBridgeApis.MediaMetadataKey.DISC_NUMBER.name -> "com.google.android.gms.cast.metadata.DISC_NUMBER" + PlatformBridgeApis.MediaMetadataKey.EPISODE_NUMBER.name -> "com.google.android.gms.cast.metadata.EPISODE_NUMBER" + PlatformBridgeApis.MediaMetadataKey.HEIGHT.name -> "com.google.android.gms.cast.metadata.HEIGHT" + PlatformBridgeApis.MediaMetadataKey.LOCATION_LATITUDE.name -> "com.google.android.gms.cast.metadata.LOCATION_LATITUDE" + PlatformBridgeApis.MediaMetadataKey.LOCATION_LONGITUDE.name -> "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE" + PlatformBridgeApis.MediaMetadataKey.LOCATION_NAME.name -> "com.google.android.gms.cast.metadata.LOCATION_NAME" + PlatformBridgeApis.MediaMetadataKey.QUEUE_ITEM_ID.name -> "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID" + PlatformBridgeApis.MediaMetadataKey.RELEASE_DATE.name -> "com.google.android.gms.cast.metadata.RELEASE_DATE" + PlatformBridgeApis.MediaMetadataKey.SEASON_NUMBER.name -> "com.google.android.gms.cast.metadata.SEASON_NUMBER" + PlatformBridgeApis.MediaMetadataKey.SECTION_DURATION.name -> "com.google.android.gms.cast.metadata.SECTION_DURATION" + PlatformBridgeApis.MediaMetadataKey.SECTION_START_ABSOLUTE_TIME.name -> "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME" + PlatformBridgeApis.MediaMetadataKey.SECTION_START_TIME_IN_CONTAINER.name -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER" + PlatformBridgeApis.MediaMetadataKey.SECTION_START_TIME_IN_MEDIA.name -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA" + PlatformBridgeApis.MediaMetadataKey.SERIES_TITLE.name -> "com.google.android.gms.cast.metadata.SERIES_TITLE" + PlatformBridgeApis.MediaMetadataKey.STUDIO.name -> "com.google.android.gms.cast.metadata.STUDIO" + PlatformBridgeApis.MediaMetadataKey.SUBTITLE.name -> "com.google.android.gms.cast.metadata.SUBTITLE" + PlatformBridgeApis.MediaMetadataKey.TITLE.name -> "com.google.android.gms.cast.metadata.TITLE" + PlatformBridgeApis.MediaMetadataKey.TRACK_NUMBER.name -> "com.google.android.gms.cast.metadata.TRACK_NUMBER" + PlatformBridgeApis.MediaMetadataKey.WIDTH.name -> "com.google.android.gms.cast.metadata.WIDTH" else -> throw IllegalArgumentException("mediaMetadataKey.strings keys is incorrect") } } @@ -141,22 +141,22 @@ fun getMediaTrack(mediaTrack: PlatformBridgeApis.MediaTrack): MediaTrack { fun getTrackType(trackType: PlatformBridgeApis.TrackType): Int { return when (trackType) { - PlatformBridgeApis.TrackType.unknown -> 0 - PlatformBridgeApis.TrackType.text -> 1 - PlatformBridgeApis.TrackType.audio -> 2 - PlatformBridgeApis.TrackType.video -> 3 + PlatformBridgeApis.TrackType.UNKNOWN -> 0 + PlatformBridgeApis.TrackType.TEXT -> 1 + PlatformBridgeApis.TrackType.AUDIO -> 2 + PlatformBridgeApis.TrackType.VIDEO -> 3 } } fun getTrackSubtype(trackSubtype: PlatformBridgeApis.TrackSubtype): Int { return when (trackSubtype) { - PlatformBridgeApis.TrackSubtype.unknown -> -1 - PlatformBridgeApis.TrackSubtype.none -> 0 - PlatformBridgeApis.TrackSubtype.subtitles -> 1 - PlatformBridgeApis.TrackSubtype.captions -> 2 - PlatformBridgeApis.TrackSubtype.descriptions -> 3 - PlatformBridgeApis.TrackSubtype.chapters -> 4 - PlatformBridgeApis.TrackSubtype.metadata -> 5 + PlatformBridgeApis.TrackSubtype.UNKNOWN -> -1 + PlatformBridgeApis.TrackSubtype.NONE -> 0 + PlatformBridgeApis.TrackSubtype.SUBTITLES -> 1 + PlatformBridgeApis.TrackSubtype.CAPTIONS -> 2 + PlatformBridgeApis.TrackSubtype.DESCRIPTIONS -> 3 + PlatformBridgeApis.TrackSubtype.CHAPTERS -> 4 + PlatformBridgeApis.TrackSubtype.METADATA -> 5 } } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 73b14db..b6ecd24 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,21 +26,18 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 31 + compileSdkVersion 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' } - lintOptions { - disable 'InvalidPackage' - } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.gianlucaparadise.flutter_cast_framework_example" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -53,6 +50,10 @@ android { signingConfig signingConfigs.debug } } + lint { + disable 'InvalidPackage' + } + namespace 'com.gianlucaparadise.flutter_cast_framework_example' } flutter { diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 50ee96d..f880684 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 35a3896..3367da9 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/example/android/build.gradle b/example/android/build.gradle index 4c5a033..e8f7526 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.5.31' + ext.kotlin_version = '1.6.21' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 939efa2..6b66533 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/example/ios/Podfile b/example/ios/Podfile index 1e8c3c9..88359b2 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 56648ce..78c426b 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -36,6 +36,6 @@ SPEC CHECKSUMS: GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91 Protobuf: e9b99dd5da72f665ec503b19191f245a22188b4d -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c +PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index a72fe91..554712c 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -171,7 +171,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = "The Chromium Authors"; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -217,6 +217,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -231,6 +232,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -380,7 +382,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -402,7 +404,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", @@ -463,7 +465,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -512,7 +514,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -536,7 +538,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", @@ -567,7 +569,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb2dffc..c87d15a 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/example/lib/media_load_request_data_helper.dart b/example/lib/media_load_request_data_helper.dart index f5af7cd..7c00891 100644 --- a/example/lib/media_load_request_data_helper.dart +++ b/example/lib/media_load_request_data_helper.dart @@ -1,5 +1,5 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter_cast_framework/cast.dart'; +import 'package:recase/recase.dart'; /// in seconds const double QUEUE_PRELOAD_TIME = 20; @@ -92,8 +92,8 @@ MediaInfo _getMediaInfo(VideoInfo video) { final mediaMetadata = MediaMetadata() ..mediaType = MediaType.movie ..strings = { - describeEnum(MediaMetadataKey.title): video.title, - describeEnum(MediaMetadataKey.subtitle): video.studio, + MediaMetadataKey.title.name.constantCase: video.title, + MediaMetadataKey.subtitle.name.constantCase: video.studio, } ..webImages = [ img, diff --git a/example/lib/widgets/QueueItemHeading.dart b/example/lib/widgets/QueueItemHeading.dart index 9ed831b..b306e66 100644 --- a/example/lib/widgets/QueueItemHeading.dart +++ b/example/lib/widgets/QueueItemHeading.dart @@ -1,6 +1,6 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_cast_framework/cast.dart'; +import 'package:recase/recase.dart'; class QueueItemHeading extends StatelessWidget { final MediaInfo? mediaInfo; @@ -13,9 +13,9 @@ class QueueItemHeading extends StatelessWidget { @override Widget build(BuildContext context) { final titleText = mediaInfo - ?.mediaMetadata?.strings?[describeEnum(MediaMetadataKey.title)]; + ?.mediaMetadata?.strings?[MediaMetadataKey.title.name.constantCase]; final subtitleText = mediaInfo - ?.mediaMetadata?.strings?[describeEnum(MediaMetadataKey.subtitle)]; + ?.mediaMetadata?.strings?[MediaMetadataKey.subtitle.name.constantCase]; return Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/example/pubspec.lock b/example/pubspec.lock index dcbda9e..d304a1f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -53,10 +53,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: a937da4c006989739ceb4d10e3bd6cce64ca85d0fe287fc5b2b9f6ee757dcee6 + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "1.0.5" fake_async: dependency: transitive description: @@ -146,6 +146,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.0" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" sky_engine: dependency: transitive description: flutter @@ -203,10 +211,10 @@ packages: dependency: "direct main" description: name: transparent_image - sha256: e566a616922a781489f4d91cc939b1b3203b6e4a093317805f2f82f0bb0f8dec + sha256: e8991d955a2094e197ca24c645efec2faf4285772a4746126ca12875e54ca02f url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" vector_graphics: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 493c0ee..7a9bac9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -12,8 +12,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 - transparent_image: ^2.0.0 + cupertino_icons: ^1.0.5 + transparent_image: ^2.0.1 dev_dependencies: flutter_test: diff --git a/ios/Classes/MessageCastingChannel.swift b/ios/Classes/MessageCastingChannel.swift index 93a5d87..91c6d95 100644 --- a/ios/Classes/MessageCastingChannel.swift +++ b/ios/Classes/MessageCastingChannel.swift @@ -25,7 +25,7 @@ class MessageCastingChannel : GCKCastChannel { castMessage.namespace = namespace castMessage.message = message - flutterApi.onMessageReceivedMessage(castMessage) { (_: Error?) in + flutterApi.onMessageReceivedMessage(castMessage) { (_: FlutterError?) in } } diff --git a/ios/Classes/PlatformBridgeApis.h b/ios/Classes/PlatformBridgeApis.h index c189015..57ba1fe 100644 --- a/ios/Classes/PlatformBridgeApis.h +++ b/ios/Classes/PlatformBridgeApis.h @@ -1,6 +1,8 @@ -// Autogenerated from Pigeon (v3.1.0), do not edit directly. +// Autogenerated from Pigeon (v9.0.7), do not edit directly. // See also: https://pub.dev/packages/pigeon + #import + @protocol FlutterBinaryMessenger; @protocol FlutterMessageCodec; @class FlutterError; @@ -8,77 +10,139 @@ NS_ASSUME_NONNULL_BEGIN +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaInfo typedef NS_ENUM(NSUInteger, StreamType) { + /// An invalid (unknown) stream type. StreamTypeInvalid = 0, + /// A stream type of "none". StreamTypeNone = 1, + /// A buffered stream type. StreamTypeBuffered = 2, + /// A live stream type. StreamTypeLive = 3, }; +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata typedef NS_ENUM(NSUInteger, MediaType) { + /// A media type representing generic media content. MediaTypeGeneric = 0, + /// A media type representing a movie. MediaTypeMovie = 1, + /// A media type representing an TV show. MediaTypeTvShow = 2, + /// A media type representing a music track. MediaTypeMusicTrack = 3, + /// A media type representing a photo. MediaTypePhoto = 4, + /// A media type representing an audiobook chapter. MediaTypeAudiobookChapter = 5, + /// The smallest media type value that can be assigned for application-defined media types. MediaTypeUser = 6, }; +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata typedef NS_ENUM(NSUInteger, MediaMetadataKey) { + /// String key: Album artist. MediaMetadataKeyAlbumArtist = 0, + /// String key: Album title. MediaMetadataKeyAlbumTitle = 1, + /// String key: Artist. MediaMetadataKeyArtist = 2, + /// String key: Audiobook title. MediaMetadataKeyBookTitle = 3, + /// String key: Broadcast date. MediaMetadataKeyBroadcastDate = 4, + /// String key: Chapter number. MediaMetadataKeyChapterNumber = 5, + /// String key: Chapter title. MediaMetadataKeyChapterTitle = 6, + /// String key: Composer. MediaMetadataKeyComposer = 7, + /// String key: Creation date. MediaMetadataKeyCreationDate = 8, + /// Integer key: Disc number. MediaMetadataKeyDiscNumber = 9, + /// Integer key: Episode number. MediaMetadataKeyEpisodeNumber = 10, + /// Integer key: Height. MediaMetadataKeyHeight = 11, + /// Double key: Location latitude. MediaMetadataKeyLocationLatitude = 12, + /// Double key: Location longitude. MediaMetadataKeyLocationLongitude = 13, + /// String key: Location name. MediaMetadataKeyLocationName = 14, + /// Int key: Queue item ID. MediaMetadataKeyQueueItemId = 15, + /// String key: Release date. MediaMetadataKeyReleaseDate = 16, + /// Integer key: Season number. MediaMetadataKeySeasonNumber = 17, + /// Time key in milliseconds: section duration. MediaMetadataKeySectionDuration = 18, + /// Time key in milliseconds: section start absolute time. MediaMetadataKeySectionStartAbsoluteTime = 19, + /// Time key in milliseconds: section start time in the container. MediaMetadataKeySectionStartTimeInContainer = 20, + /// Time key in milliseconds: section start time in media item. MediaMetadataKeySectionStartTimeInMedia = 21, + /// String key: Series title. MediaMetadataKeySeriesTitle = 22, + /// String key: Studio. MediaMetadataKeyStudio = 23, + /// String key: Subtitle. MediaMetadataKeySubtitle = 24, + /// String key: Title. MediaMetadataKeyTitle = 25, + /// Integer key: Track number. MediaMetadataKeyTrackNumber = 26, + /// Integer key: Width. MediaMetadataKeyWidth = 27, }; +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack typedef NS_ENUM(NSUInteger, TrackType) { + /// A media track type indicating an unknown track type. TrackTypeUnknown = 0, + /// A media track type indicating a text track. TrackTypeText = 1, + /// A media track type indicating an audio track. TrackTypeAudio = 2, + /// A media track type indicating a video track. TrackTypeVideo = 3, }; +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack typedef NS_ENUM(NSUInteger, TrackSubtype) { + /// A media track subtype indicating an unknown subtype. TrackSubtypeUnknown = 0, + /// A media track subtype indicating no subtype. TrackSubtypeNone = 1, + /// A media track subtype indicating subtitles. TrackSubtypeSubtitles = 2, + /// A media track subtype indicating closed captions. TrackSubtypeCaptions = 3, + /// A media track subtype indicating descriptions. TrackSubtypeDescriptions = 4, + /// A media track subtype indicating chapters. TrackSubtypeChapters = 5, + /// A media track subtype indicating metadata. TrackSubtypeMetadata = 6, }; +/// State of the remote media player typedef NS_ENUM(NSUInteger, PlayerState) { + /// Constant indicating unknown player state. PlayerStateUnknown = 0, + /// Constant indicating that the media player is idle. PlayerStateIdle = 1, + /// Constant indicating that the media player is playing. PlayerStatePlaying = 2, + /// Constant indicating that the media player is paused. PlayerStatePaused = 3, + /// Constant indicating that the media player is buffering. PlayerStateBuffering = 4, + /// Constant indicating that the media player is loading. PlayerStateLoading = 5, }; @@ -94,6 +158,7 @@ typedef NS_ENUM(NSUInteger, PlayerState) { @class CastDevice; @class CastMessage; +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaLoadRequestData @interface MediaLoadRequestData : NSObject + (instancetype)makeWithShouldAutoplay:(nullable NSNumber *)shouldAutoplay currentTime:(nullable NSNumber *)currentTime @@ -103,6 +168,7 @@ typedef NS_ENUM(NSUInteger, PlayerState) { @property(nonatomic, strong, nullable) MediaInfo * mediaInfo; @end +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaInfo @interface MediaInfo : NSObject + (instancetype)makeWithContentId:(nullable NSString *)contentId streamType:(StreamType)streamType @@ -119,9 +185,11 @@ typedef NS_ENUM(NSUInteger, PlayerState) { @property(nonatomic, strong, nullable) NSArray * mediaTracks; @property(nonatomic, strong, nullable) NSNumber * streamDuration; @property(nonatomic, strong, nullable) NSArray * adBreakClips; +/// String containing a json object @property(nonatomic, copy, nullable) NSString * customDataAsJson; @end +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata @interface MediaMetadata : NSObject + (instancetype)makeWithMediaType:(MediaType)mediaType strings:(nullable NSDictionary *)strings @@ -131,11 +199,13 @@ typedef NS_ENUM(NSUInteger, PlayerState) { @property(nonatomic, strong, nullable) NSArray * webImages; @end +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/common/images/WebImage @interface WebImage : NSObject + (instancetype)makeWithUrl:(nullable NSString *)url; @property(nonatomic, copy, nullable) NSString * url; @end +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack @interface MediaTrack : NSObject + (instancetype)makeWithId:(nullable NSNumber *)id trackType:(TrackType)trackType @@ -226,6 +296,7 @@ typedef NS_ENUM(NSUInteger, PlayerState) { /// The codec used by CastHostApi. NSObject *CastHostApiGetCodec(void); +/// APIs for Flutter-to-Host comunication @protocol CastHostApi - (void)sendMessageMessage:(CastMessage *)message error:(FlutterError *_Nullable *_Nonnull)error; - (void)showCastDialogWithError:(FlutterError *_Nullable *_Nonnull)error; @@ -254,35 +325,37 @@ extern void CastHostApiSetup(id binaryMessenger, NSObjec /// The codec used by CastFlutterApi. NSObject *CastFlutterApiGetCodec(void); +/// APIs for Host-to-Flutter comunication @interface CastFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)getSessionMessageNamespacesWithCompletion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion; -- (void)onCastStateChangedCastState:(NSNumber *)castState completion:(void(^)(NSError *_Nullable))completion; -- (void)onMessageReceivedMessage:(CastMessage *)message completion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionStartingWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionStartedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionStartFailedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionEndingWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionEndedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionResumingWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onStatusUpdatedMediaStatus:(MediaStatus *)mediaStatus completion:(void(^)(NSError *_Nullable))completion; -- (void)onMetadataUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onQueueStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onPreloadStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onSendingRemoteMediaRequestWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onAdBreakStatusUpdatedMediaStatus:(MediaStatus *)mediaStatus completion:(void(^)(NSError *_Nullable))completion; -- (void)onMediaErrorWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)onProgressUpdatedProgressMs:(NSNumber *)progressMs durationMs:(NSNumber *)durationMs completion:(void(^)(NSError *_Nullable))completion; -- (void)onAdBreakClipProgressUpdatedAdBreakId:(NSString *)adBreakId adBreakClipId:(NSString *)adBreakClipId progressMs:(NSNumber *)progressMs durationMs:(NSNumber *)durationMs whenSkippableMs:(NSNumber *)whenSkippableMs completion:(void(^)(NSError *_Nullable))completion; -- (void)itemsInsertedInRangeInsertIndex:(NSNumber *)insertIndex insertCount:(NSNumber *)insertCount completion:(void(^)(NSError *_Nullable))completion; -- (void)itemsReloadedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)itemsRemovedAtIndexesIndexes:(NSArray *)indexes completion:(void(^)(NSError *_Nullable))completion; -- (void)itemsReorderedAtIndexesIndexes:(NSArray *)indexes insertBeforeIndex:(NSNumber *)insertBeforeIndex completion:(void(^)(NSError *_Nullable))completion; -- (void)itemsUpdatedAtIndexesIndexes:(NSArray *)indexes completion:(void(^)(NSError *_Nullable))completion; -- (void)mediaQueueChangedWithCompletion:(void(^)(NSError *_Nullable))completion; -- (void)mediaQueueWillChangeWithCompletion:(void(^)(NSError *_Nullable))completion; +- (void)getSessionMessageNamespacesWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; +- (void)onCastStateChangedCastState:(NSNumber *)castState completion:(void (^)(FlutterError *_Nullable))completion; +- (void)onMessageReceivedMessage:(CastMessage *)message completion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionStartingWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionStartedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionStartFailedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionEndingWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionEndedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionResumingWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionResumedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionResumeFailedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSessionSuspendedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onStatusUpdatedMediaStatus:(MediaStatus *)mediaStatus completion:(void (^)(FlutterError *_Nullable))completion; +- (void)onMetadataUpdatedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onQueueStatusUpdatedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onPreloadStatusUpdatedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onSendingRemoteMediaRequestWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onAdBreakStatusUpdatedMediaStatus:(MediaStatus *)mediaStatus completion:(void (^)(FlutterError *_Nullable))completion; +- (void)onMediaErrorWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)onProgressUpdatedProgressMs:(NSNumber *)progressMs durationMs:(NSNumber *)durationMs completion:(void (^)(FlutterError *_Nullable))completion; +- (void)onAdBreakClipProgressUpdatedAdBreakId:(NSString *)adBreakId adBreakClipId:(NSString *)adBreakClipId progressMs:(NSNumber *)progressMs durationMs:(NSNumber *)durationMs whenSkippableMs:(NSNumber *)whenSkippableMs completion:(void (^)(FlutterError *_Nullable))completion; +- (void)itemsInsertedInRangeInsertIndex:(NSNumber *)insertIndex insertCount:(NSNumber *)insertCount completion:(void (^)(FlutterError *_Nullable))completion; +- (void)itemsReloadedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)itemsRemovedAtIndexesIndexes:(NSArray *)indexes completion:(void (^)(FlutterError *_Nullable))completion; +- (void)itemsReorderedAtIndexesIndexes:(NSArray *)indexes insertBeforeIndex:(NSNumber *)insertBeforeIndex completion:(void (^)(FlutterError *_Nullable))completion; +- (void)itemsUpdatedAtIndexesIndexes:(NSArray *)indexes completion:(void (^)(FlutterError *_Nullable))completion; +- (void)mediaQueueChangedWithCompletion:(void (^)(FlutterError *_Nullable))completion; +- (void)mediaQueueWillChangeWithCompletion:(void (^)(FlutterError *_Nullable))completion; @end + NS_ASSUME_NONNULL_END diff --git a/ios/Classes/PlatformBridgeApis.m b/ios/Classes/PlatformBridgeApis.m index fb585b1..f6c543c 100644 --- a/ios/Classes/PlatformBridgeApis.m +++ b/ios/Classes/PlatformBridgeApis.m @@ -1,5 +1,6 @@ -// Autogenerated from Pigeon (v3.1.0), do not edit directly. +// Autogenerated from Pigeon (v9.0.7), do not edit directly. // See also: https://pub.dev/packages/pigeon + #import "PlatformBridgeApis.h" #import @@ -7,73 +8,83 @@ #error File requires ARC to be enabled. #endif -static NSDictionary *wrapResult(id result, FlutterError *error) { - NSDictionary *errorDict = (NSDictionary *)[NSNull null]; +static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - errorDict = @{ - @"code": (error.code ?: [NSNull null]), - @"message": (error.message ?: [NSNull null]), - @"details": (error.details ?: [NSNull null]), - }; + return @[ + error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] + ]; } - return @{ - @"result": (result ?: [NSNull null]), - @"error": errorDict, - }; + return @[ result ?: [NSNull null] ]; } -static id GetNullableObject(NSDictionary* dict, id key) { - id result = dict[key]; - return (result == [NSNull null]) ? nil : result; -} -static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { +static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; return (result == [NSNull null]) ? nil : result; } - @interface MediaLoadRequestData () -+ (MediaLoadRequestData *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (MediaLoadRequestData *)fromList:(NSArray *)list; ++ (nullable MediaLoadRequestData *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface MediaInfo () -+ (MediaInfo *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (MediaInfo *)fromList:(NSArray *)list; ++ (nullable MediaInfo *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface MediaMetadata () -+ (MediaMetadata *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (MediaMetadata *)fromList:(NSArray *)list; ++ (nullable MediaMetadata *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface WebImage () -+ (WebImage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (WebImage *)fromList:(NSArray *)list; ++ (nullable WebImage *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface MediaTrack () -+ (MediaTrack *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (MediaTrack *)fromList:(NSArray *)list; ++ (nullable MediaTrack *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface MediaStatus () -+ (MediaStatus *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (MediaStatus *)fromList:(NSArray *)list; ++ (nullable MediaStatus *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface AdBreakStatus () -+ (AdBreakStatus *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (AdBreakStatus *)fromList:(NSArray *)list; ++ (nullable AdBreakStatus *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface AdBreakClipInfo () -+ (AdBreakClipInfo *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (AdBreakClipInfo *)fromList:(NSArray *)list; ++ (nullable AdBreakClipInfo *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface MediaQueueItem () -+ (MediaQueueItem *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (MediaQueueItem *)fromList:(NSArray *)list; ++ (nullable MediaQueueItem *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface CastDevice () -+ (CastDevice *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (CastDevice *)fromList:(NSArray *)list; ++ (nullable CastDevice *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface CastMessage () -+ (CastMessage *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (CastMessage *)fromList:(NSArray *)list; ++ (nullable CastMessage *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @implementation MediaLoadRequestData @@ -86,19 +97,22 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.mediaInfo = mediaInfo; return pigeonResult; } -+ (MediaLoadRequestData *)fromMap:(NSDictionary *)dict { ++ (MediaLoadRequestData *)fromList:(NSArray *)list { MediaLoadRequestData *pigeonResult = [[MediaLoadRequestData alloc] init]; - pigeonResult.shouldAutoplay = GetNullableObject(dict, @"shouldAutoplay"); - pigeonResult.currentTime = GetNullableObject(dict, @"currentTime"); - pigeonResult.mediaInfo = [MediaInfo fromMap:GetNullableObject(dict, @"mediaInfo")]; + pigeonResult.shouldAutoplay = GetNullableObjectAtIndex(list, 0); + pigeonResult.currentTime = GetNullableObjectAtIndex(list, 1); + pigeonResult.mediaInfo = [MediaInfo nullableFromList:(GetNullableObjectAtIndex(list, 2))]; return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"shouldAutoplay" : (self.shouldAutoplay ?: [NSNull null]), - @"currentTime" : (self.currentTime ?: [NSNull null]), - @"mediaInfo" : (self.mediaInfo ? [self.mediaInfo toMap] : [NSNull null]), - }; ++ (nullable MediaLoadRequestData *)nullableFromList:(NSArray *)list { + return (list) ? [MediaLoadRequestData fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.shouldAutoplay ?: [NSNull null]), + (self.currentTime ?: [NSNull null]), + (self.mediaInfo ? [self.mediaInfo toList] : [NSNull null]), + ]; } @end @@ -122,29 +136,32 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.customDataAsJson = customDataAsJson; return pigeonResult; } -+ (MediaInfo *)fromMap:(NSDictionary *)dict { ++ (MediaInfo *)fromList:(NSArray *)list { MediaInfo *pigeonResult = [[MediaInfo alloc] init]; - pigeonResult.contentId = GetNullableObject(dict, @"contentId"); - pigeonResult.streamType = [GetNullableObject(dict, @"streamType") integerValue]; - pigeonResult.contentType = GetNullableObject(dict, @"contentType"); - pigeonResult.mediaMetadata = [MediaMetadata fromMap:GetNullableObject(dict, @"mediaMetadata")]; - pigeonResult.mediaTracks = GetNullableObject(dict, @"mediaTracks"); - pigeonResult.streamDuration = GetNullableObject(dict, @"streamDuration"); - pigeonResult.adBreakClips = GetNullableObject(dict, @"adBreakClips"); - pigeonResult.customDataAsJson = GetNullableObject(dict, @"customDataAsJson"); + pigeonResult.contentId = GetNullableObjectAtIndex(list, 0); + pigeonResult.streamType = [GetNullableObjectAtIndex(list, 1) integerValue]; + pigeonResult.contentType = GetNullableObjectAtIndex(list, 2); + pigeonResult.mediaMetadata = [MediaMetadata nullableFromList:(GetNullableObjectAtIndex(list, 3))]; + pigeonResult.mediaTracks = GetNullableObjectAtIndex(list, 4); + pigeonResult.streamDuration = GetNullableObjectAtIndex(list, 5); + pigeonResult.adBreakClips = GetNullableObjectAtIndex(list, 6); + pigeonResult.customDataAsJson = GetNullableObjectAtIndex(list, 7); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"contentId" : (self.contentId ?: [NSNull null]), - @"streamType" : @(self.streamType), - @"contentType" : (self.contentType ?: [NSNull null]), - @"mediaMetadata" : (self.mediaMetadata ? [self.mediaMetadata toMap] : [NSNull null]), - @"mediaTracks" : (self.mediaTracks ?: [NSNull null]), - @"streamDuration" : (self.streamDuration ?: [NSNull null]), - @"adBreakClips" : (self.adBreakClips ?: [NSNull null]), - @"customDataAsJson" : (self.customDataAsJson ?: [NSNull null]), - }; ++ (nullable MediaInfo *)nullableFromList:(NSArray *)list { + return (list) ? [MediaInfo fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.contentId ?: [NSNull null]), + @(self.streamType), + (self.contentType ?: [NSNull null]), + (self.mediaMetadata ? [self.mediaMetadata toList] : [NSNull null]), + (self.mediaTracks ?: [NSNull null]), + (self.streamDuration ?: [NSNull null]), + (self.adBreakClips ?: [NSNull null]), + (self.customDataAsJson ?: [NSNull null]), + ]; } @end @@ -158,19 +175,22 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.webImages = webImages; return pigeonResult; } -+ (MediaMetadata *)fromMap:(NSDictionary *)dict { ++ (MediaMetadata *)fromList:(NSArray *)list { MediaMetadata *pigeonResult = [[MediaMetadata alloc] init]; - pigeonResult.mediaType = [GetNullableObject(dict, @"mediaType") integerValue]; - pigeonResult.strings = GetNullableObject(dict, @"strings"); - pigeonResult.webImages = GetNullableObject(dict, @"webImages"); + pigeonResult.mediaType = [GetNullableObjectAtIndex(list, 0) integerValue]; + pigeonResult.strings = GetNullableObjectAtIndex(list, 1); + pigeonResult.webImages = GetNullableObjectAtIndex(list, 2); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"mediaType" : @(self.mediaType), - @"strings" : (self.strings ?: [NSNull null]), - @"webImages" : (self.webImages ?: [NSNull null]), - }; ++ (nullable MediaMetadata *)nullableFromList:(NSArray *)list { + return (list) ? [MediaMetadata fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + @(self.mediaType), + (self.strings ?: [NSNull null]), + (self.webImages ?: [NSNull null]), + ]; } @end @@ -180,15 +200,18 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.url = url; return pigeonResult; } -+ (WebImage *)fromMap:(NSDictionary *)dict { ++ (WebImage *)fromList:(NSArray *)list { WebImage *pigeonResult = [[WebImage alloc] init]; - pigeonResult.url = GetNullableObject(dict, @"url"); + pigeonResult.url = GetNullableObjectAtIndex(list, 0); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"url" : (self.url ?: [NSNull null]), - }; ++ (nullable WebImage *)nullableFromList:(NSArray *)list { + return (list) ? [WebImage fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.url ?: [NSNull null]), + ]; } @end @@ -208,25 +231,28 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.language = language; return pigeonResult; } -+ (MediaTrack *)fromMap:(NSDictionary *)dict { ++ (MediaTrack *)fromList:(NSArray *)list { MediaTrack *pigeonResult = [[MediaTrack alloc] init]; - pigeonResult.id = GetNullableObject(dict, @"id"); - pigeonResult.trackType = [GetNullableObject(dict, @"trackType") integerValue]; - pigeonResult.name = GetNullableObject(dict, @"name"); - pigeonResult.trackSubtype = [GetNullableObject(dict, @"trackSubtype") integerValue]; - pigeonResult.contentId = GetNullableObject(dict, @"contentId"); - pigeonResult.language = GetNullableObject(dict, @"language"); + pigeonResult.id = GetNullableObjectAtIndex(list, 0); + pigeonResult.trackType = [GetNullableObjectAtIndex(list, 1) integerValue]; + pigeonResult.name = GetNullableObjectAtIndex(list, 2); + pigeonResult.trackSubtype = [GetNullableObjectAtIndex(list, 3) integerValue]; + pigeonResult.contentId = GetNullableObjectAtIndex(list, 4); + pigeonResult.language = GetNullableObjectAtIndex(list, 5); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"id" : (self.id ?: [NSNull null]), - @"trackType" : @(self.trackType), - @"name" : (self.name ?: [NSNull null]), - @"trackSubtype" : @(self.trackSubtype), - @"contentId" : (self.contentId ?: [NSNull null]), - @"language" : (self.language ?: [NSNull null]), - }; ++ (nullable MediaTrack *)nullableFromList:(NSArray *)list { + return (list) ? [MediaTrack fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.id ?: [NSNull null]), + @(self.trackType), + (self.name ?: [NSNull null]), + @(self.trackSubtype), + (self.contentId ?: [NSNull null]), + (self.language ?: [NSNull null]), + ]; } @end @@ -242,21 +268,24 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.adBreakStatus = adBreakStatus; return pigeonResult; } -+ (MediaStatus *)fromMap:(NSDictionary *)dict { ++ (MediaStatus *)fromList:(NSArray *)list { MediaStatus *pigeonResult = [[MediaStatus alloc] init]; - pigeonResult.playerState = [GetNullableObject(dict, @"playerState") integerValue]; - pigeonResult.isPlayingAd = GetNullableObject(dict, @"isPlayingAd"); - pigeonResult.mediaInfo = [MediaInfo fromMap:GetNullableObject(dict, @"mediaInfo")]; - pigeonResult.adBreakStatus = [AdBreakStatus fromMap:GetNullableObject(dict, @"adBreakStatus")]; + pigeonResult.playerState = [GetNullableObjectAtIndex(list, 0) integerValue]; + pigeonResult.isPlayingAd = GetNullableObjectAtIndex(list, 1); + pigeonResult.mediaInfo = [MediaInfo nullableFromList:(GetNullableObjectAtIndex(list, 2))]; + pigeonResult.adBreakStatus = [AdBreakStatus nullableFromList:(GetNullableObjectAtIndex(list, 3))]; return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"playerState" : @(self.playerState), - @"isPlayingAd" : (self.isPlayingAd ?: [NSNull null]), - @"mediaInfo" : (self.mediaInfo ? [self.mediaInfo toMap] : [NSNull null]), - @"adBreakStatus" : (self.adBreakStatus ? [self.adBreakStatus toMap] : [NSNull null]), - }; ++ (nullable MediaStatus *)nullableFromList:(NSArray *)list { + return (list) ? [MediaStatus fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + @(self.playerState), + (self.isPlayingAd ?: [NSNull null]), + (self.mediaInfo ? [self.mediaInfo toList] : [NSNull null]), + (self.adBreakStatus ? [self.adBreakStatus toList] : [NSNull null]), + ]; } @end @@ -270,19 +299,22 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.whenSkippableMs = whenSkippableMs; return pigeonResult; } -+ (AdBreakStatus *)fromMap:(NSDictionary *)dict { ++ (AdBreakStatus *)fromList:(NSArray *)list { AdBreakStatus *pigeonResult = [[AdBreakStatus alloc] init]; - pigeonResult.adBreakId = GetNullableObject(dict, @"adBreakId"); - pigeonResult.adBreakClipId = GetNullableObject(dict, @"adBreakClipId"); - pigeonResult.whenSkippableMs = GetNullableObject(dict, @"whenSkippableMs"); + pigeonResult.adBreakId = GetNullableObjectAtIndex(list, 0); + pigeonResult.adBreakClipId = GetNullableObjectAtIndex(list, 1); + pigeonResult.whenSkippableMs = GetNullableObjectAtIndex(list, 2); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"adBreakId" : (self.adBreakId ?: [NSNull null]), - @"adBreakClipId" : (self.adBreakClipId ?: [NSNull null]), - @"whenSkippableMs" : (self.whenSkippableMs ?: [NSNull null]), - }; ++ (nullable AdBreakStatus *)nullableFromList:(NSArray *)list { + return (list) ? [AdBreakStatus fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.adBreakId ?: [NSNull null]), + (self.adBreakClipId ?: [NSNull null]), + (self.whenSkippableMs ?: [NSNull null]), + ]; } @end @@ -308,31 +340,34 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.whenSkippableMs = whenSkippableMs; return pigeonResult; } -+ (AdBreakClipInfo *)fromMap:(NSDictionary *)dict { ++ (AdBreakClipInfo *)fromList:(NSArray *)list { AdBreakClipInfo *pigeonResult = [[AdBreakClipInfo alloc] init]; - pigeonResult.id = GetNullableObject(dict, @"id"); - pigeonResult.title = GetNullableObject(dict, @"title"); - pigeonResult.contentId = GetNullableObject(dict, @"contentId"); - pigeonResult.contentUrl = GetNullableObject(dict, @"contentUrl"); - pigeonResult.clickThroughUrl = GetNullableObject(dict, @"clickThroughUrl"); - pigeonResult.durationMs = GetNullableObject(dict, @"durationMs"); - pigeonResult.imageUrl = GetNullableObject(dict, @"imageUrl"); - pigeonResult.mimeType = GetNullableObject(dict, @"mimeType"); - pigeonResult.whenSkippableMs = GetNullableObject(dict, @"whenSkippableMs"); + pigeonResult.id = GetNullableObjectAtIndex(list, 0); + pigeonResult.title = GetNullableObjectAtIndex(list, 1); + pigeonResult.contentId = GetNullableObjectAtIndex(list, 2); + pigeonResult.contentUrl = GetNullableObjectAtIndex(list, 3); + pigeonResult.clickThroughUrl = GetNullableObjectAtIndex(list, 4); + pigeonResult.durationMs = GetNullableObjectAtIndex(list, 5); + pigeonResult.imageUrl = GetNullableObjectAtIndex(list, 6); + pigeonResult.mimeType = GetNullableObjectAtIndex(list, 7); + pigeonResult.whenSkippableMs = GetNullableObjectAtIndex(list, 8); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"id" : (self.id ?: [NSNull null]), - @"title" : (self.title ?: [NSNull null]), - @"contentId" : (self.contentId ?: [NSNull null]), - @"contentUrl" : (self.contentUrl ?: [NSNull null]), - @"clickThroughUrl" : (self.clickThroughUrl ?: [NSNull null]), - @"durationMs" : (self.durationMs ?: [NSNull null]), - @"imageUrl" : (self.imageUrl ?: [NSNull null]), - @"mimeType" : (self.mimeType ?: [NSNull null]), - @"whenSkippableMs" : (self.whenSkippableMs ?: [NSNull null]), - }; ++ (nullable AdBreakClipInfo *)nullableFromList:(NSArray *)list { + return (list) ? [AdBreakClipInfo fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.id ?: [NSNull null]), + (self.title ?: [NSNull null]), + (self.contentId ?: [NSNull null]), + (self.contentUrl ?: [NSNull null]), + (self.clickThroughUrl ?: [NSNull null]), + (self.durationMs ?: [NSNull null]), + (self.imageUrl ?: [NSNull null]), + (self.mimeType ?: [NSNull null]), + (self.whenSkippableMs ?: [NSNull null]), + ]; } @end @@ -352,25 +387,28 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.preloadTime = preloadTime; return pigeonResult; } -+ (MediaQueueItem *)fromMap:(NSDictionary *)dict { ++ (MediaQueueItem *)fromList:(NSArray *)list { MediaQueueItem *pigeonResult = [[MediaQueueItem alloc] init]; - pigeonResult.itemId = GetNullableObject(dict, @"itemId"); - pigeonResult.playbackDuration = GetNullableObject(dict, @"playbackDuration"); - pigeonResult.startTime = GetNullableObject(dict, @"startTime"); - pigeonResult.media = [MediaInfo fromMap:GetNullableObject(dict, @"media")]; - pigeonResult.autoplay = GetNullableObject(dict, @"autoplay"); - pigeonResult.preloadTime = GetNullableObject(dict, @"preloadTime"); + pigeonResult.itemId = GetNullableObjectAtIndex(list, 0); + pigeonResult.playbackDuration = GetNullableObjectAtIndex(list, 1); + pigeonResult.startTime = GetNullableObjectAtIndex(list, 2); + pigeonResult.media = [MediaInfo nullableFromList:(GetNullableObjectAtIndex(list, 3))]; + pigeonResult.autoplay = GetNullableObjectAtIndex(list, 4); + pigeonResult.preloadTime = GetNullableObjectAtIndex(list, 5); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"itemId" : (self.itemId ?: [NSNull null]), - @"playbackDuration" : (self.playbackDuration ?: [NSNull null]), - @"startTime" : (self.startTime ?: [NSNull null]), - @"media" : (self.media ? [self.media toMap] : [NSNull null]), - @"autoplay" : (self.autoplay ?: [NSNull null]), - @"preloadTime" : (self.preloadTime ?: [NSNull null]), - }; ++ (nullable MediaQueueItem *)nullableFromList:(NSArray *)list { + return (list) ? [MediaQueueItem fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.itemId ?: [NSNull null]), + (self.playbackDuration ?: [NSNull null]), + (self.startTime ?: [NSNull null]), + (self.media ? [self.media toList] : [NSNull null]), + (self.autoplay ?: [NSNull null]), + (self.preloadTime ?: [NSNull null]), + ]; } @end @@ -384,19 +422,22 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.modelName = modelName; return pigeonResult; } -+ (CastDevice *)fromMap:(NSDictionary *)dict { ++ (CastDevice *)fromList:(NSArray *)list { CastDevice *pigeonResult = [[CastDevice alloc] init]; - pigeonResult.deviceId = GetNullableObject(dict, @"deviceId"); - pigeonResult.friendlyName = GetNullableObject(dict, @"friendlyName"); - pigeonResult.modelName = GetNullableObject(dict, @"modelName"); + pigeonResult.deviceId = GetNullableObjectAtIndex(list, 0); + pigeonResult.friendlyName = GetNullableObjectAtIndex(list, 1); + pigeonResult.modelName = GetNullableObjectAtIndex(list, 2); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"deviceId" : (self.deviceId ?: [NSNull null]), - @"friendlyName" : (self.friendlyName ?: [NSNull null]), - @"modelName" : (self.modelName ?: [NSNull null]), - }; ++ (nullable CastDevice *)nullableFromList:(NSArray *)list { + return (list) ? [CastDevice fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.deviceId ?: [NSNull null]), + (self.friendlyName ?: [NSNull null]), + (self.modelName ?: [NSNull null]), + ]; } @end @@ -408,56 +449,48 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { pigeonResult.message = message; return pigeonResult; } -+ (CastMessage *)fromMap:(NSDictionary *)dict { ++ (CastMessage *)fromList:(NSArray *)list { CastMessage *pigeonResult = [[CastMessage alloc] init]; - pigeonResult.namespace = GetNullableObject(dict, @"namespace"); - pigeonResult.message = GetNullableObject(dict, @"message"); + pigeonResult.namespace = GetNullableObjectAtIndex(list, 0); + pigeonResult.message = GetNullableObjectAtIndex(list, 1); return pigeonResult; } -- (NSDictionary *)toMap { - return @{ - @"namespace" : (self.namespace ?: [NSNull null]), - @"message" : (self.message ?: [NSNull null]), - }; ++ (nullable CastMessage *)nullableFromList:(NSArray *)list { + return (list) ? [CastMessage fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.namespace ?: [NSNull null]), + (self.message ?: [NSNull null]), + ]; } @end @interface CastHostApiCodecReader : FlutterStandardReader @end @implementation CastHostApiCodecReader -- (nullable id)readValueOfType:(UInt8)type -{ +- (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: - return [AdBreakClipInfo fromMap:[self readValue]]; - - case 129: - return [CastDevice fromMap:[self readValue]]; - - case 130: - return [CastMessage fromMap:[self readValue]]; - - case 131: - return [MediaInfo fromMap:[self readValue]]; - - case 132: - return [MediaLoadRequestData fromMap:[self readValue]]; - - case 133: - return [MediaMetadata fromMap:[self readValue]]; - - case 134: - return [MediaQueueItem fromMap:[self readValue]]; - - case 135: - return [MediaTrack fromMap:[self readValue]]; - - case 136: - return [WebImage fromMap:[self readValue]]; - - default: + case 128: + return [AdBreakClipInfo fromList:[self readValue]]; + case 129: + return [CastDevice fromList:[self readValue]]; + case 130: + return [CastMessage fromList:[self readValue]]; + case 131: + return [MediaInfo fromList:[self readValue]]; + case 132: + return [MediaLoadRequestData fromList:[self readValue]]; + case 133: + return [MediaMetadata fromList:[self readValue]]; + case 134: + return [MediaQueueItem fromList:[self readValue]]; + case 135: + return [MediaTrack fromList:[self readValue]]; + case 136: + return [WebImage fromList:[self readValue]]; + default: return [super readValueOfType:type]; - } } @end @@ -465,45 +498,35 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { @interface CastHostApiCodecWriter : FlutterStandardWriter @end @implementation CastHostApiCodecWriter -- (void)writeValue:(id)value -{ +- (void)writeValue:(id)value { if ([value isKindOfClass:[AdBreakClipInfo class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[CastDevice class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[CastDevice class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[CastMessage class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[CastMessage class]]) { [self writeByte:130]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[MediaInfo class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[MediaInfo class]]) { [self writeByte:131]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[MediaLoadRequestData class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[MediaLoadRequestData class]]) { [self writeByte:132]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[MediaMetadata class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[MediaMetadata class]]) { [self writeByte:133]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[MediaQueueItem class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[MediaQueueItem class]]) { [self writeByte:134]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[MediaTrack class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[MediaTrack class]]) { [self writeByte:135]; - [self writeValue:[value toMap]]; - } else - if ([value isKindOfClass:[WebImage class]]) { + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[WebImage class]]) { [self writeByte:136]; - [self writeValue:[value toMap]]; - } else -{ + [self writeValue:[value toList]]; + } else { [super writeValue:value]; } } @@ -521,8 +544,8 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) { @end NSObject *CastHostApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ CastHostApiCodecReaderWriter *readerWriter = [[CastHostApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; @@ -530,14 +553,13 @@ NSObject *CastHostApiGetCodec() { return sSharedObject; } - void CastHostApiSetup(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] initWithName:@"dev.flutter.pigeon.CastHostApi.sendMessage" binaryMessenger:binaryMessenger - codec:CastHostApiGetCodec() ]; + codec:CastHostApiGetCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(sendMessageMessage:error:)], @"CastHostApi api (%@) doesn't respond to @selector(sendMessageMessage:error:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -547,8 +569,7 @@ void CastHostApiSetup(id binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject binaryMessenger, NSObject *CastFlutterApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ CastFlutterApiCodecReaderWriter *readerWriter = [[CastFlutterApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; @@ -932,9 +919,8 @@ NSObject *CastFlutterApiGetCodec() { return sSharedObject; } - @interface CastFlutterApi () -@property (nonatomic, strong) NSObject *binaryMessenger; +@property(nonatomic, strong) NSObject *binaryMessenger; @end @implementation CastFlutterApi @@ -946,7 +932,7 @@ NSObject *CastFlutterApiGetCodec() { } return self; } -- (void)getSessionMessageNamespacesWithCompletion:(void(^)(NSArray *_Nullable, NSError *_Nullable))completion { +- (void)getSessionMessageNamespacesWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.getSessionMessageNamespaces" @@ -957,7 +943,7 @@ NSObject *CastFlutterApiGetCodec() { completion(output, nil); }]; } -- (void)onCastStateChangedCastState:(NSNumber *)arg_castState completion:(void(^)(NSError *_Nullable))completion { +- (void)onCastStateChangedCastState:(NSNumber *)arg_castState completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onCastStateChanged" @@ -967,7 +953,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onMessageReceivedMessage:(CastMessage *)arg_message completion:(void(^)(NSError *_Nullable))completion { +- (void)onMessageReceivedMessage:(CastMessage *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMessageReceived" @@ -977,7 +963,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionStartingWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionStartingWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStarting" @@ -987,7 +973,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionStartedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionStartedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStarted" @@ -997,7 +983,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionStartFailedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionStartFailedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed" @@ -1007,7 +993,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionEndingWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionEndingWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionEnding" @@ -1017,7 +1003,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionEndedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionEndedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionEnded" @@ -1027,7 +1013,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionResumingWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionResumingWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResuming" @@ -1037,7 +1023,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionResumedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResumed" @@ -1047,7 +1033,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionResumeFailedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed" @@ -1057,7 +1043,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSessionSuspendedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSessionSuspended" @@ -1067,7 +1053,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onStatusUpdatedMediaStatus:(MediaStatus *)arg_mediaStatus completion:(void(^)(NSError *_Nullable))completion { +- (void)onStatusUpdatedMediaStatus:(MediaStatus *)arg_mediaStatus completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onStatusUpdated" @@ -1077,7 +1063,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onMetadataUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onMetadataUpdatedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated" @@ -1087,7 +1073,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onQueueStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onQueueStatusUpdatedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated" @@ -1097,7 +1083,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onPreloadStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onPreloadStatusUpdatedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated" @@ -1107,7 +1093,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onSendingRemoteMediaRequestWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onSendingRemoteMediaRequestWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest" @@ -1117,7 +1103,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onAdBreakStatusUpdatedMediaStatus:(MediaStatus *)arg_mediaStatus completion:(void(^)(NSError *_Nullable))completion { +- (void)onAdBreakStatusUpdatedMediaStatus:(MediaStatus *)arg_mediaStatus completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated" @@ -1127,7 +1113,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onMediaErrorWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)onMediaErrorWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMediaError" @@ -1137,7 +1123,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onProgressUpdatedProgressMs:(NSNumber *)arg_progressMs durationMs:(NSNumber *)arg_durationMs completion:(void(^)(NSError *_Nullable))completion { +- (void)onProgressUpdatedProgressMs:(NSNumber *)arg_progressMs durationMs:(NSNumber *)arg_durationMs completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onProgressUpdated" @@ -1147,7 +1133,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)onAdBreakClipProgressUpdatedAdBreakId:(NSString *)arg_adBreakId adBreakClipId:(NSString *)arg_adBreakClipId progressMs:(NSNumber *)arg_progressMs durationMs:(NSNumber *)arg_durationMs whenSkippableMs:(NSNumber *)arg_whenSkippableMs completion:(void(^)(NSError *_Nullable))completion { +- (void)onAdBreakClipProgressUpdatedAdBreakId:(NSString *)arg_adBreakId adBreakClipId:(NSString *)arg_adBreakClipId progressMs:(NSNumber *)arg_progressMs durationMs:(NSNumber *)arg_durationMs whenSkippableMs:(NSNumber *)arg_whenSkippableMs completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated" @@ -1157,7 +1143,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)itemsInsertedInRangeInsertIndex:(NSNumber *)arg_insertIndex insertCount:(NSNumber *)arg_insertCount completion:(void(^)(NSError *_Nullable))completion { +- (void)itemsInsertedInRangeInsertIndex:(NSNumber *)arg_insertIndex insertCount:(NSNumber *)arg_insertCount completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange" @@ -1167,7 +1153,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)itemsReloadedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)itemsReloadedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsReloaded" @@ -1177,7 +1163,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)itemsRemovedAtIndexesIndexes:(NSArray *)arg_indexes completion:(void(^)(NSError *_Nullable))completion { +- (void)itemsRemovedAtIndexesIndexes:(NSArray *)arg_indexes completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes" @@ -1187,7 +1173,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)itemsReorderedAtIndexesIndexes:(NSArray *)arg_indexes insertBeforeIndex:(NSNumber *)arg_insertBeforeIndex completion:(void(^)(NSError *_Nullable))completion { +- (void)itemsReorderedAtIndexesIndexes:(NSArray *)arg_indexes insertBeforeIndex:(NSNumber *)arg_insertBeforeIndex completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes" @@ -1197,7 +1183,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)itemsUpdatedAtIndexesIndexes:(NSArray *)arg_indexes completion:(void(^)(NSError *_Nullable))completion { +- (void)itemsUpdatedAtIndexesIndexes:(NSArray *)arg_indexes completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes" @@ -1207,7 +1193,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)mediaQueueChangedWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)mediaQueueChangedWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.mediaQueueChanged" @@ -1217,7 +1203,7 @@ NSObject *CastFlutterApiGetCodec() { completion(nil); }]; } -- (void)mediaQueueWillChangeWithCompletion:(void(^)(NSError *_Nullable))completion { +- (void)mediaQueueWillChangeWithCompletion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.mediaQueueWillChange" @@ -1228,3 +1214,4 @@ NSObject *CastFlutterApiGetCodec() { }]; } @end + diff --git a/ios/Classes/SwiftFlutterCastFrameworkPlugin.swift b/ios/Classes/SwiftFlutterCastFrameworkPlugin.swift index 20da5b3..84f9c45 100644 --- a/ios/Classes/SwiftFlutterCastFrameworkPlugin.swift +++ b/ios/Classes/SwiftFlutterCastFrameworkPlugin.swift @@ -135,7 +135,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio let castStateRaw = castState.rawValue // Android CastStates are 1-to-4, while iOS CastStates are 0-to-3. I align iOS to Android by adding 1 let castStateRawAdjusted = castStateRaw + 1 - self.flutterApi.onCastStateChangedCastState(NSNumber(value: castStateRawAdjusted)) { (_: Error?) in + self.flutterApi.onCastStateChangedCastState(NSNumber(value: castStateRawAdjusted)) { (_: FlutterError?) in } } @@ -225,7 +225,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio let nsAdBreakClipDuration = NSNumber(value: adBreakClipDurationMs) DispatchQueue.main.async { - self.flutterApi.onAdBreakClipProgressUpdatedAdBreakId(adBreakId, adBreakClipId: adBreakClipId, progressMs: nsAdBreakClipProgress, durationMs: nsAdBreakClipDuration, whenSkippableMs: nsWhenSkippable) { (_:Error?) in + self.flutterApi.onAdBreakClipProgressUpdatedAdBreakId(adBreakId, adBreakClipId: adBreakClipId, progressMs: nsAdBreakClipProgress, durationMs: nsAdBreakClipDuration, whenSkippableMs: nsWhenSkippable) { (_:FlutterError?) in } } } @@ -241,7 +241,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio let nsProgress = NSNumber(value: progressMs) DispatchQueue.main.async { - self.flutterApi.onProgressUpdatedProgressMs(nsProgress, durationMs: nsDuration) { (_:Error?) in + self.flutterApi.onProgressUpdatedProgressMs(nsProgress, durationMs: nsDuration) { (_:FlutterError?) in } } } @@ -386,14 +386,14 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio // onSessionSuspended public func sessionManager(_ sessionManager: GCKSessionManager, didSuspend session: GCKCastSession, with reason: GCKConnectionSuspendReason) { debugPrint("SessionListener: didSuspend") - flutterApi.onSessionSuspended { (_:Error?) in + flutterApi.onSessionSuspended { (_:FlutterError?) in } } // onSessionStarting public func sessionManager(_ sessionManager: GCKSessionManager, willStart session: GCKCastSession) { debugPrint("SessionListener: willStart") - flutterApi.onSessionStarting { (_:Error?) in + flutterApi.onSessionStarting { (_:FlutterError?) in } castSession = session @@ -402,7 +402,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio // onSessionResuming public func sessionManager(_ sessionManager: GCKSessionManager, willResumeCastSession session: GCKCastSession) { debugPrint("SessionListener: willResumeCastSession") - flutterApi.onSessionResuming { (_:Error?) in + flutterApi.onSessionResuming { (_:FlutterError?) in } castSession = session @@ -412,14 +412,14 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio public func sessionManager(_ sessionManager: GCKSessionManager, willEnd session: GCKCastSession) { debugPrint("SessionListener: willEnd") stopProgressTimer() - flutterApi.onSessionEnding { (_:Error?) in + flutterApi.onSessionEnding { (_:FlutterError?) in } } // onSessionStartFailed public func sessionManager(_ sessionManager: GCKSessionManager, didFailToStart session: GCKCastSession, withError error: Error) { debugPrint("SessionListener: didFailToStart") - flutterApi.onSessionStartFailed { (_:Error?) in + flutterApi.onSessionStartFailed { (_:FlutterError?) in } } @@ -428,7 +428,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio // onSessionStarted public func sessionManager(_ sessionManager: GCKSessionManager, didStart session: GCKCastSession) { debugPrint("SessionListener: didStart") - flutterApi.onSessionStarted { (_:Error?) in + flutterApi.onSessionStarted { (_:FlutterError?) in } castSession = session @@ -437,7 +437,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio // onSessionResumed public func sessionManager(_ sessionManager: GCKSessionManager, didResumeCastSession session: GCKCastSession) { debugPrint("SessionListener: didResumeCastSession") - flutterApi.onSessionResumed { (_:Error?) in + flutterApi.onSessionResumed { (_:FlutterError?) in } castSession = session @@ -446,21 +446,21 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio // onSessionEnded public func sessionManager(_ sessionManager: GCKSessionManager, didEnd session: GCKCastSession, withError error: Error?) { debugPrint("SessionListener: didEnd") - flutterApi.onSessionEnded { (_:Error?) in + flutterApi.onSessionEnded { (_:FlutterError?) in } } // onQueueStatusUpdated public func remoteMediaClientDidUpdateQueue(_ client: GCKRemoteMediaClient) { debugPrint("RemoteMediaClientListener: didUpdateQueue") - flutterApi.onQueueStatusUpdated { (_:Error?) in + flutterApi.onQueueStatusUpdated { (_:FlutterError?) in } } // onPreloadStatusUpdated public func remoteMediaClientDidUpdatePreloadStatus(_ client: GCKRemoteMediaClient) { debugPrint("RemoteMediaClientListener: didUpdatePreloadStatus") - flutterApi.onPreloadStatusUpdated { (_:Error?) in + flutterApi.onPreloadStatusUpdated { (_:FlutterError?) in } } @@ -490,9 +490,9 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio debugPrint("RemoteMediaClientListener: didUpdate mediaStatus - playerState: \(playerStateLabel)") let flutterMediaStatus = getFlutterMediaStatus(mediaStatus: mediaStatus) - flutterApi.onStatusUpdatedMediaStatus(flutterMediaStatus) { (_:Error?) in + flutterApi.onStatusUpdatedMediaStatus(flutterMediaStatus) { (_:FlutterError?) in } - flutterApi.onAdBreakStatusUpdatedMediaStatus(flutterMediaStatus) { (_:Error?) in + flutterApi.onAdBreakStatusUpdatedMediaStatus(flutterMediaStatus) { (_:FlutterError?) in } } @@ -502,70 +502,70 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio // onMetadataUpdated public func remoteMediaClient(_ client: GCKRemoteMediaClient, didUpdate mediaMetadata: GCKMediaMetadata?) { debugPrint("RemoteMediaClientListener: didUpdate mediaMetadata") - flutterApi.onMetadataUpdated { (_:Error?) in + flutterApi.onMetadataUpdated { (_:FlutterError?) in } } // onQueueStatusUpdated public func remoteMediaClient(_ client: GCKRemoteMediaClient, didReceive queueItems: [GCKMediaQueueItem]) { debugPrint("RemoteMediaClientListener: didReceive queueItems") - flutterApi.onQueueStatusUpdated { (_:Error?) in + flutterApi.onQueueStatusUpdated { (_:FlutterError?) in } } // onSendingRemoteMediaRequest public func remoteMediaClient(_ client: GCKRemoteMediaClient, didStartMediaSessionWithID sessionID: Int) { debugPrint("RemoteMediaClientListener: didStartMediaSessionWithID") - flutterApi.onSendingRemoteMediaRequest { (_:Error?) in + flutterApi.onSendingRemoteMediaRequest { (_:FlutterError?) in } } // onQueueStatusUpdated public func remoteMediaClient(_ client: GCKRemoteMediaClient, didReceiveQueueItemIDs queueItemIDs: [NSNumber]) { debugPrint("RemoteMediaClientListener: didReceiveQueueItemIDs") - flutterApi.onQueueStatusUpdated { (_:Error?) in + flutterApi.onQueueStatusUpdated { (_:FlutterError?) in } } // onQueueStatusUpdated public func remoteMediaClient(_ client: GCKRemoteMediaClient, didUpdateQueueItemsWithIDs queueItemIDs: [NSNumber]) { debugPrint("RemoteMediaClientListener: didUpdateQueueItemsWithIDs") - flutterApi.onQueueStatusUpdated { (_:Error?) in + flutterApi.onQueueStatusUpdated { (_:FlutterError?) in } } // onQueueStatusUpdated public func remoteMediaClient(_ client: GCKRemoteMediaClient, didRemoveQueueItemsWithIDs queueItemIDs: [NSNumber]) { debugPrint("RemoteMediaClientListener: didRemoveQueueItemsWithIDs") - flutterApi.onQueueStatusUpdated { (_:Error?) in + flutterApi.onQueueStatusUpdated { (_:FlutterError?) in } } // onQueueStatusUpdated public func remoteMediaClient(_ client: GCKRemoteMediaClient, didInsertQueueItemsWithIDs queueItemIDs: [NSNumber], beforeItemWithID beforeItemID: UInt) { debugPrint("RemoteMediaClientListener: didInsertQueueItemsWithIDs") - flutterApi.onQueueStatusUpdated { (_:Error?) in + flutterApi.onQueueStatusUpdated { (_:FlutterError?) in } } // mediaQueueWillChange public func mediaQueueWillChange(_ queue: GCKMediaQueue) { debugPrint("MediaQueueListener: mediaQueueWillChange") - flutterApi.mediaQueueWillChange { (_:Error?) in + flutterApi.mediaQueueWillChange { (_:FlutterError?) in } } // mediaQueueChanged public func mediaQueueDidChange(_ queue: GCKMediaQueue) { debugPrint("MediaQueueListener: mediaQueueDidChange") - flutterApi.mediaQueueChanged { (_:Error?) in + flutterApi.mediaQueueChanged { (_:FlutterError?) in } } // itemsReloaded public func mediaQueueDidReloadItems(_ queue: GCKMediaQueue) { debugPrint("MediaQueueListener: mediaQueueDidReloadItems") - flutterApi.itemsReloaded { (_:Error?) in + flutterApi.itemsReloaded { (_:FlutterError?) in } } @@ -574,21 +574,21 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio debugPrint("MediaQueueListener: mediaQueueDidInsertItemsIn") let count = range.upperBound - range.lowerBound let start = range.lowerBound - flutterApi.itemsInserted(inRangeInsertIndex: NSNumber(value: start), insertCount: NSNumber(value: count)) { (_:Error?) in + flutterApi.itemsInserted(inRangeInsertIndex: NSNumber(value: start), insertCount: NSNumber(value: count)) { (_:FlutterError?) in } } // itemsUpdatedAtIndexes public func mediaQueue(_ queue: GCKMediaQueue, didUpdateItemsAtIndexes indexes: [NSNumber]) { debugPrint("MediaQueueListener: mediaQueueDidUpdateItemsAtIndexes") - flutterApi.itemsUpdated(atIndexesIndexes: indexes) { (_:Error?) in + flutterApi.itemsUpdated(atIndexesIndexes: indexes) { (_:FlutterError?) in } } // itemsRemovedAtIndexes public func mediaQueue(_ queue: GCKMediaQueue, didRemoveItemsAtIndexes indexes: [NSNumber]) { debugPrint("MediaQueueListener: mediaQueueDidRemoveItemsAtIndexes") - flutterApi.itemsRemoved(atIndexesIndexes: indexes) { (_:Error?) in + flutterApi.itemsRemoved(atIndexesIndexes: indexes) { (_:FlutterError?) in } } diff --git a/lib/src/PlatformBridgeApis.dart b/lib/src/PlatformBridgeApis.dart index f402254..387adaa 100644 --- a/lib/src/PlatformBridgeApis.dart +++ b/lib/src/PlatformBridgeApis.dart @@ -1,87 +1,150 @@ -// Autogenerated from Pigeon (v3.1.0), do not edit directly. +// Autogenerated from Pigeon (v9.0.7), 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 -// @dart = 2.12 -import 'dart:async'; -import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; +// 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 -import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; +import 'dart:async'; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; + +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaInfo enum StreamType { + /// An invalid (unknown) stream type. invalid, + /// A stream type of "none". none, + /// A buffered stream type. buffered, + /// A live stream type. live, } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata enum MediaType { + /// A media type representing generic media content. generic, + /// A media type representing a movie. movie, + /// A media type representing an TV show. tvShow, + /// A media type representing a music track. musicTrack, + /// A media type representing a photo. photo, + /// A media type representing an audiobook chapter. audiobookChapter, + /// The smallest media type value that can be assigned for application-defined media types. user, } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata enum MediaMetadataKey { + /// String key: Album artist. albumArtist, + /// String key: Album title. albumTitle, + /// String key: Artist. artist, + /// String key: Audiobook title. bookTitle, + /// String key: Broadcast date. broadcastDate, + /// String key: Chapter number. chapterNumber, + /// String key: Chapter title. chapterTitle, + /// String key: Composer. composer, + /// String key: Creation date. creationDate, + /// Integer key: Disc number. discNumber, + /// Integer key: Episode number. episodeNumber, + /// Integer key: Height. height, + /// Double key: Location latitude. locationLatitude, + /// Double key: Location longitude. locationLongitude, + /// String key: Location name. locationName, + /// Int key: Queue item ID. queueItemId, + /// String key: Release date. releaseDate, + /// Integer key: Season number. seasonNumber, + /// Time key in milliseconds: section duration. sectionDuration, + /// Time key in milliseconds: section start absolute time. sectionStartAbsoluteTime, + /// Time key in milliseconds: section start time in the container. sectionStartTimeInContainer, + /// Time key in milliseconds: section start time in media item. sectionStartTimeInMedia, + /// String key: Series title. seriesTitle, + /// String key: Studio. studio, + /// String key: Subtitle. subtitle, + /// String key: Title. title, + /// Integer key: Track number. trackNumber, + /// Integer key: Width. width, } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack enum TrackType { + /// A media track type indicating an unknown track type. unknown, + /// A media track type indicating a text track. text, + /// A media track type indicating an audio track. audio, + /// A media track type indicating a video track. video, } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack enum TrackSubtype { + /// A media track subtype indicating an unknown subtype. unknown, + /// A media track subtype indicating no subtype. none, + /// A media track subtype indicating subtitles. subtitles, + /// A media track subtype indicating closed captions. captions, + /// A media track subtype indicating descriptions. descriptions, + /// A media track subtype indicating chapters. chapters, + /// A media track subtype indicating metadata. metadata, } +/// State of the remote media player enum PlayerState { + /// Constant indicating unknown player state. unknown, + /// Constant indicating that the media player is idle. idle, + /// Constant indicating that the media player is playing. playing, + /// Constant indicating that the media player is paused. paused, + /// Constant indicating that the media player is buffering. buffering, + /// Constant indicating that the media player is loading. loading, } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaLoadRequestData class MediaLoadRequestData { MediaLoadRequestData({ this.shouldAutoplay, @@ -90,29 +153,32 @@ class MediaLoadRequestData { }); bool? shouldAutoplay; + int? currentTime; + MediaInfo? mediaInfo; Object encode() { - final Map pigeonMap = {}; - pigeonMap['shouldAutoplay'] = shouldAutoplay; - pigeonMap['currentTime'] = currentTime; - pigeonMap['mediaInfo'] = mediaInfo?.encode(); - return pigeonMap; + return [ + shouldAutoplay, + currentTime, + mediaInfo?.encode(), + ]; } - static MediaLoadRequestData decode(Object message) { - final Map pigeonMap = message as Map; + static MediaLoadRequestData decode(Object result) { + result as List; return MediaLoadRequestData( - shouldAutoplay: pigeonMap['shouldAutoplay'] as bool?, - currentTime: pigeonMap['currentTime'] as int?, - mediaInfo: pigeonMap['mediaInfo'] != null - ? MediaInfo.decode(pigeonMap['mediaInfo']!) + shouldAutoplay: result[0] as bool?, + currentTime: result[1] as int?, + mediaInfo: result[2] != null + ? MediaInfo.decode(result[2]! as List) : null, ); } } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaInfo class MediaInfo { MediaInfo({ this.contentId, @@ -126,46 +192,55 @@ class MediaInfo { }); String? contentId; + StreamType? streamType; + String? contentType; + MediaMetadata? mediaMetadata; + List? mediaTracks; + int? streamDuration; + List? adBreakClips; + + /// String containing a json object String? customDataAsJson; Object encode() { - final Map pigeonMap = {}; - pigeonMap['contentId'] = contentId; - pigeonMap['streamType'] = streamType?.index; - pigeonMap['contentType'] = contentType; - pigeonMap['mediaMetadata'] = mediaMetadata?.encode(); - pigeonMap['mediaTracks'] = mediaTracks; - pigeonMap['streamDuration'] = streamDuration; - pigeonMap['adBreakClips'] = adBreakClips; - pigeonMap['customDataAsJson'] = customDataAsJson; - return pigeonMap; + return [ + contentId, + streamType?.index, + contentType, + mediaMetadata?.encode(), + mediaTracks, + streamDuration, + adBreakClips, + customDataAsJson, + ]; } - static MediaInfo decode(Object message) { - final Map pigeonMap = message as Map; + static MediaInfo decode(Object result) { + result as List; return MediaInfo( - contentId: pigeonMap['contentId'] as String?, - streamType: pigeonMap['streamType'] != null - ? StreamType.values[pigeonMap['streamType']! as int] + contentId: result[0] as String?, + streamType: result[1] != null + ? StreamType.values[result[1]! as int] : null, - contentType: pigeonMap['contentType'] as String?, - mediaMetadata: pigeonMap['mediaMetadata'] != null - ? MediaMetadata.decode(pigeonMap['mediaMetadata']!) + contentType: result[2] as String?, + mediaMetadata: result[3] != null + ? MediaMetadata.decode(result[3]! as List) : null, - mediaTracks: (pigeonMap['mediaTracks'] as List?)?.cast(), - streamDuration: pigeonMap['streamDuration'] as int?, - adBreakClips: (pigeonMap['adBreakClips'] as List?)?.cast(), - customDataAsJson: pigeonMap['customDataAsJson'] as String?, + mediaTracks: (result[4] as List?)?.cast(), + streamDuration: result[5] as int?, + adBreakClips: (result[6] as List?)?.cast(), + customDataAsJson: result[7] as String?, ); } } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata class MediaMetadata { MediaMetadata({ this.mediaType, @@ -174,29 +249,32 @@ class MediaMetadata { }); MediaType? mediaType; + Map? strings; + List? webImages; Object encode() { - final Map pigeonMap = {}; - pigeonMap['mediaType'] = mediaType?.index; - pigeonMap['strings'] = strings; - pigeonMap['webImages'] = webImages; - return pigeonMap; + return [ + mediaType?.index, + strings, + webImages, + ]; } - static MediaMetadata decode(Object message) { - final Map pigeonMap = message as Map; + static MediaMetadata decode(Object result) { + result as List; return MediaMetadata( - mediaType: pigeonMap['mediaType'] != null - ? MediaType.values[pigeonMap['mediaType']! as int] + mediaType: result[0] != null + ? MediaType.values[result[0]! as int] : null, - strings: (pigeonMap['strings'] as Map?)?.cast(), - webImages: (pigeonMap['webImages'] as List?)?.cast(), + strings: (result[1] as Map?)?.cast(), + webImages: (result[2] as List?)?.cast(), ); } } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/common/images/WebImage class WebImage { WebImage({ this.url, @@ -205,19 +283,20 @@ class WebImage { String? url; Object encode() { - final Map pigeonMap = {}; - pigeonMap['url'] = url; - return pigeonMap; + return [ + url, + ]; } - static WebImage decode(Object message) { - final Map pigeonMap = message as Map; + static WebImage decode(Object result) { + result as List; return WebImage( - url: pigeonMap['url'] as String?, + url: result[0] as String?, ); } } +/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack class MediaTrack { MediaTrack({ this.id, @@ -229,36 +308,41 @@ class MediaTrack { }); int? id; + TrackType? trackType; + String? name; + TrackSubtype? trackSubtype; + String? contentId; + String? language; Object encode() { - final Map pigeonMap = {}; - pigeonMap['id'] = id; - pigeonMap['trackType'] = trackType?.index; - pigeonMap['name'] = name; - pigeonMap['trackSubtype'] = trackSubtype?.index; - pigeonMap['contentId'] = contentId; - pigeonMap['language'] = language; - return pigeonMap; + return [ + id, + trackType?.index, + name, + trackSubtype?.index, + contentId, + language, + ]; } - static MediaTrack decode(Object message) { - final Map pigeonMap = message as Map; + static MediaTrack decode(Object result) { + result as List; return MediaTrack( - id: pigeonMap['id'] as int?, - trackType: pigeonMap['trackType'] != null - ? TrackType.values[pigeonMap['trackType']! as int] + id: result[0] as int?, + trackType: result[1] != null + ? TrackType.values[result[1]! as int] : null, - name: pigeonMap['name'] as String?, - trackSubtype: pigeonMap['trackSubtype'] != null - ? TrackSubtype.values[pigeonMap['trackSubtype']! as int] + name: result[2] as String?, + trackSubtype: result[3] != null + ? TrackSubtype.values[result[3]! as int] : null, - contentId: pigeonMap['contentId'] as String?, - language: pigeonMap['language'] as String?, + contentId: result[4] as String?, + language: result[5] as String?, ); } } @@ -272,31 +356,34 @@ class MediaStatus { }); PlayerState? playerState; + bool? isPlayingAd; + MediaInfo? mediaInfo; + AdBreakStatus? adBreakStatus; Object encode() { - final Map pigeonMap = {}; - pigeonMap['playerState'] = playerState?.index; - pigeonMap['isPlayingAd'] = isPlayingAd; - pigeonMap['mediaInfo'] = mediaInfo?.encode(); - pigeonMap['adBreakStatus'] = adBreakStatus?.encode(); - return pigeonMap; + return [ + playerState?.index, + isPlayingAd, + mediaInfo?.encode(), + adBreakStatus?.encode(), + ]; } - static MediaStatus decode(Object message) { - final Map pigeonMap = message as Map; + static MediaStatus decode(Object result) { + result as List; return MediaStatus( - playerState: pigeonMap['playerState'] != null - ? PlayerState.values[pigeonMap['playerState']! as int] + playerState: result[0] != null + ? PlayerState.values[result[0]! as int] : null, - isPlayingAd: pigeonMap['isPlayingAd'] as bool?, - mediaInfo: pigeonMap['mediaInfo'] != null - ? MediaInfo.decode(pigeonMap['mediaInfo']!) + isPlayingAd: result[1] as bool?, + mediaInfo: result[2] != null + ? MediaInfo.decode(result[2]! as List) : null, - adBreakStatus: pigeonMap['adBreakStatus'] != null - ? AdBreakStatus.decode(pigeonMap['adBreakStatus']!) + adBreakStatus: result[3] != null + ? AdBreakStatus.decode(result[3]! as List) : null, ); } @@ -310,23 +397,25 @@ class AdBreakStatus { }); String? adBreakId; + String? adBreakClipId; + int? whenSkippableMs; Object encode() { - final Map pigeonMap = {}; - pigeonMap['adBreakId'] = adBreakId; - pigeonMap['adBreakClipId'] = adBreakClipId; - pigeonMap['whenSkippableMs'] = whenSkippableMs; - return pigeonMap; + return [ + adBreakId, + adBreakClipId, + whenSkippableMs, + ]; } - static AdBreakStatus decode(Object message) { - final Map pigeonMap = message as Map; + static AdBreakStatus decode(Object result) { + result as List; return AdBreakStatus( - adBreakId: pigeonMap['adBreakId'] as String?, - adBreakClipId: pigeonMap['adBreakClipId'] as String?, - whenSkippableMs: pigeonMap['whenSkippableMs'] as int?, + adBreakId: result[0] as String?, + adBreakClipId: result[1] as String?, + whenSkippableMs: result[2] as int?, ); } } @@ -345,41 +434,49 @@ class AdBreakClipInfo { }); String? id; + String? title; + String? contentId; + String? contentUrl; + String? clickThroughUrl; + int? durationMs; + String? imageUrl; + String? mimeType; + int? whenSkippableMs; Object encode() { - final Map pigeonMap = {}; - pigeonMap['id'] = id; - pigeonMap['title'] = title; - pigeonMap['contentId'] = contentId; - pigeonMap['contentUrl'] = contentUrl; - pigeonMap['clickThroughUrl'] = clickThroughUrl; - pigeonMap['durationMs'] = durationMs; - pigeonMap['imageUrl'] = imageUrl; - pigeonMap['mimeType'] = mimeType; - pigeonMap['whenSkippableMs'] = whenSkippableMs; - return pigeonMap; + return [ + id, + title, + contentId, + contentUrl, + clickThroughUrl, + durationMs, + imageUrl, + mimeType, + whenSkippableMs, + ]; } - static AdBreakClipInfo decode(Object message) { - final Map pigeonMap = message as Map; + static AdBreakClipInfo decode(Object result) { + result as List; return AdBreakClipInfo( - id: pigeonMap['id'] as String?, - title: pigeonMap['title'] as String?, - contentId: pigeonMap['contentId'] as String?, - contentUrl: pigeonMap['contentUrl'] as String?, - clickThroughUrl: pigeonMap['clickThroughUrl'] as String?, - durationMs: pigeonMap['durationMs'] as int?, - imageUrl: pigeonMap['imageUrl'] as String?, - mimeType: pigeonMap['mimeType'] as String?, - whenSkippableMs: pigeonMap['whenSkippableMs'] as int?, + id: result[0] as String?, + title: result[1] as String?, + contentId: result[2] as String?, + contentUrl: result[3] as String?, + clickThroughUrl: result[4] as String?, + durationMs: result[5] as int?, + imageUrl: result[6] as String?, + mimeType: result[7] as String?, + whenSkippableMs: result[8] as int?, ); } } @@ -395,34 +492,39 @@ class MediaQueueItem { }); int? itemId; + double? playbackDuration; + double? startTime; + MediaInfo? media; + bool? autoplay; + double? preloadTime; Object encode() { - final Map pigeonMap = {}; - pigeonMap['itemId'] = itemId; - pigeonMap['playbackDuration'] = playbackDuration; - pigeonMap['startTime'] = startTime; - pigeonMap['media'] = media?.encode(); - pigeonMap['autoplay'] = autoplay; - pigeonMap['preloadTime'] = preloadTime; - return pigeonMap; + return [ + itemId, + playbackDuration, + startTime, + media?.encode(), + autoplay, + preloadTime, + ]; } - static MediaQueueItem decode(Object message) { - final Map pigeonMap = message as Map; + static MediaQueueItem decode(Object result) { + result as List; return MediaQueueItem( - itemId: pigeonMap['itemId'] as int?, - playbackDuration: pigeonMap['playbackDuration'] as double?, - startTime: pigeonMap['startTime'] as double?, - media: pigeonMap['media'] != null - ? MediaInfo.decode(pigeonMap['media']!) + itemId: result[0] as int?, + playbackDuration: result[1] as double?, + startTime: result[2] as double?, + media: result[3] != null + ? MediaInfo.decode(result[3]! as List) : null, - autoplay: pigeonMap['autoplay'] as bool?, - preloadTime: pigeonMap['preloadTime'] as double?, + autoplay: result[4] as bool?, + preloadTime: result[5] as double?, ); } } @@ -435,23 +537,25 @@ class CastDevice { }); String? deviceId; + String? friendlyName; + String? modelName; Object encode() { - final Map pigeonMap = {}; - pigeonMap['deviceId'] = deviceId; - pigeonMap['friendlyName'] = friendlyName; - pigeonMap['modelName'] = modelName; - return pigeonMap; + return [ + deviceId, + friendlyName, + modelName, + ]; } - static CastDevice decode(Object message) { - final Map pigeonMap = message as Map; + static CastDevice decode(Object result) { + result as List; return CastDevice( - deviceId: pigeonMap['deviceId'] as String?, - friendlyName: pigeonMap['friendlyName'] as String?, - modelName: pigeonMap['modelName'] as String?, + deviceId: result[0] as String?, + friendlyName: result[1] as String?, + modelName: result[2] as String?, ); } } @@ -463,20 +567,21 @@ class CastMessage { }); String? namespace; + String? message; Object encode() { - final Map pigeonMap = {}; - pigeonMap['namespace'] = namespace; - pigeonMap['message'] = message; - return pigeonMap; + return [ + namespace, + message, + ]; } - static CastMessage decode(Object message) { - final Map pigeonMap = message as Map; + static CastMessage decode(Object result) { + result as List; return CastMessage( - namespace: pigeonMap['namespace'] as String?, - message: pigeonMap['message'] as String?, + namespace: result[0] as String?, + message: result[1] as String?, ); } } @@ -488,106 +593,89 @@ class _CastHostApiCodec extends StandardMessageCodec { if (value is AdBreakClipInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is CastDevice) { + } else if (value is CastDevice) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is CastMessage) { + } else if (value is CastMessage) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is MediaInfo) { + } else if (value is MediaInfo) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is MediaLoadRequestData) { + } else if (value is MediaLoadRequestData) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is MediaMetadata) { + } else if (value is MediaMetadata) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is MediaQueueItem) { + } else if (value is MediaQueueItem) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is MediaTrack) { + } else if (value is MediaTrack) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else - if (value is WebImage) { + } else if (value is WebImage) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AdBreakClipInfo.decode(readValue(buffer)!); - - case 129: + case 129: return CastDevice.decode(readValue(buffer)!); - - case 130: + case 130: return CastMessage.decode(readValue(buffer)!); - - case 131: + case 131: return MediaInfo.decode(readValue(buffer)!); - - case 132: + case 132: return MediaLoadRequestData.decode(readValue(buffer)!); - - case 133: + case 133: return MediaMetadata.decode(readValue(buffer)!); - - case 134: + case 134: return MediaQueueItem.decode(readValue(buffer)!); - - case 135: + case 135: return MediaTrack.decode(readValue(buffer)!); - - case 136: + case 136: return WebImage.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } +/// APIs for Flutter-to-Host comunication class CastHostApi { /// Constructor for [CastHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CastHostApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - + CastHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _CastHostApiCodec(); Future sendMessage(CastMessage arg_message) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.sendMessage', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_message]) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.sendMessage', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_message]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -596,20 +684,20 @@ class CastHostApi { Future showCastDialog() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.showCastDialog', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.showCastDialog', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -618,20 +706,20 @@ class CastHostApi { Future setMute(bool arg_muted) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.setMute', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_muted]) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.setMute', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_muted]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -640,47 +728,47 @@ class CastHostApi { Future getCastDevice() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.getCastDevice', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.getCastDevice', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as CastDevice?)!; + return (replyList[0] as CastDevice?)!; } } Future loadMediaLoadRequestData(MediaLoadRequestData arg_request) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_request]) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_request]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -689,47 +777,47 @@ class CastHostApi { Future getMediaInfo() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.getMediaInfo', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.getMediaInfo', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as MediaInfo?)!; + return (replyList[0] as MediaInfo?)!; } } Future play() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.play', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.play', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -738,20 +826,20 @@ class CastHostApi { Future pause() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.pause', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.pause', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -760,20 +848,20 @@ class CastHostApi { Future stop() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.stop', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.stop', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -782,20 +870,20 @@ class CastHostApi { Future showTracksChooserDialog() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.showTracksChooserDialog', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.showTracksChooserDialog', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -804,20 +892,20 @@ class CastHostApi { Future skipAd() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.skipAd', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.skipAd', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -826,20 +914,20 @@ class CastHostApi { Future queueAppendItem(MediaQueueItem arg_item) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.queueAppendItem', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_item]) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.queueAppendItem', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_item]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -848,20 +936,20 @@ class CastHostApi { Future queueNextItem() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.queueNextItem', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.queueNextItem', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -870,20 +958,20 @@ class CastHostApi { Future queuePrevItem() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.queuePrevItem', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.queuePrevItem', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { return; @@ -892,55 +980,55 @@ class CastHostApi { Future getQueueItemCount() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.getQueueItemCount', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send(null) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.getQueueItemCount', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as int?)!; + return (replyList[0] as int?)!; } } Future getQueueItemAtIndex(int arg_index) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastHostApi.getQueueItemAtIndex', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_index]) as Map?; - if (replyMap == null) { + 'dev.flutter.pigeon.CastHostApi.getQueueItemAtIndex', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_index]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); - } else if (replyMap['result'] == null) { + } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyMap['result'] as MediaQueueItem?)!; + return (replyList[0] as MediaQueueItem?)!; } } } @@ -952,107 +1040,122 @@ class _CastFlutterApiCodec extends StandardMessageCodec { if (value is AdBreakClipInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else - if (value is AdBreakStatus) { + } else if (value is AdBreakStatus) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else - if (value is CastMessage) { + } else if (value is CastMessage) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else - if (value is MediaInfo) { + } else if (value is MediaInfo) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else - if (value is MediaMetadata) { + } else if (value is MediaMetadata) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else - if (value is MediaStatus) { + } else if (value is MediaStatus) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else - if (value is MediaTrack) { + } else if (value is MediaTrack) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else - if (value is WebImage) { + } else if (value is WebImage) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else -{ + } else { super.writeValue(buffer, value); } } + @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AdBreakClipInfo.decode(readValue(buffer)!); - - case 129: + case 129: return AdBreakStatus.decode(readValue(buffer)!); - - case 130: + case 130: return CastMessage.decode(readValue(buffer)!); - - case 131: + case 131: return MediaInfo.decode(readValue(buffer)!); - - case 132: + case 132: return MediaMetadata.decode(readValue(buffer)!); - - case 133: + case 133: return MediaStatus.decode(readValue(buffer)!); - - case 134: + case 134: return MediaTrack.decode(readValue(buffer)!); - - case 135: + case 135: return WebImage.decode(readValue(buffer)!); - - default: + default: return super.readValueOfType(type, buffer); - } } } + +/// APIs for Host-to-Flutter comunication abstract class CastFlutterApi { static const MessageCodec codec = _CastFlutterApiCodec(); List getSessionMessageNamespaces(); + void onCastStateChanged(int castState); + void onMessageReceived(CastMessage message); + void onSessionStarting(); + void onSessionStarted(); + void onSessionStartFailed(); + void onSessionEnding(); + void onSessionEnded(); + void onSessionResuming(); + void onSessionResumed(); + void onSessionResumeFailed(); + void onSessionSuspended(); + void onStatusUpdated(MediaStatus mediaStatus); + void onMetadataUpdated(); + void onQueueStatusUpdated(); + void onPreloadStatusUpdated(); + void onSendingRemoteMediaRequest(); + void onAdBreakStatusUpdated(MediaStatus mediaStatus); + void onMediaError(); + void onProgressUpdated(int progressMs, int durationMs); + void onAdBreakClipProgressUpdated(String adBreakId, String adBreakClipId, int progressMs, int durationMs, int whenSkippableMs); + void itemsInsertedInRange(int insertIndex, int insertCount); + void itemsReloaded(); + void itemsRemovedAtIndexes(List indexes); + void itemsReorderedAtIndexes(List indexes, int insertBeforeIndex); + void itemsUpdatedAtIndexes(List indexes); + void mediaQueueChanged(); + void mediaQueueWillChange(); + static void setup(CastFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.getSessionMessageNamespaces', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.getSessionMessageNamespaces', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1065,15 +1168,18 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onCastStateChanged', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onCastStateChanged', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onCastStateChanged was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onCastStateChanged was null.'); final List args = (message as List?)!; final int? arg_castState = (args[0] as int?); - assert(arg_castState != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onCastStateChanged was null, expected non-null int.'); + assert(arg_castState != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onCastStateChanged was null, expected non-null int.'); api.onCastStateChanged(arg_castState!); return; }); @@ -1081,15 +1187,18 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onMessageReceived', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onMessageReceived', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onMessageReceived was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onMessageReceived was null.'); final List args = (message as List?)!; final CastMessage? arg_message = (args[0] as CastMessage?); - assert(arg_message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onMessageReceived was null, expected non-null CastMessage.'); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onMessageReceived was null, expected non-null CastMessage.'); api.onMessageReceived(arg_message!); return; }); @@ -1097,7 +1206,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionStarting', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionStarting', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1110,7 +1220,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionStarted', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionStarted', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1123,7 +1234,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionStartFailed', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1136,7 +1248,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionEnding', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionEnding', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1149,7 +1262,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionEnded', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionEnded', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1162,7 +1276,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionResuming', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionResuming', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1175,7 +1290,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionResumed', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionResumed', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1188,7 +1304,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionResumeFailed', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1201,7 +1318,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSessionSuspended', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSessionSuspended', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1214,15 +1332,18 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onStatusUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onStatusUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onStatusUpdated was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onStatusUpdated was null.'); final List args = (message as List?)!; final MediaStatus? arg_mediaStatus = (args[0] as MediaStatus?); - assert(arg_mediaStatus != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onStatusUpdated was null, expected non-null MediaStatus.'); + assert(arg_mediaStatus != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onStatusUpdated was null, expected non-null MediaStatus.'); api.onStatusUpdated(arg_mediaStatus!); return; }); @@ -1230,7 +1351,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1243,7 +1365,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1256,7 +1379,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1269,7 +1393,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1282,15 +1407,18 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated was null.'); final List args = (message as List?)!; final MediaStatus? arg_mediaStatus = (args[0] as MediaStatus?); - assert(arg_mediaStatus != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated was null, expected non-null MediaStatus.'); + assert(arg_mediaStatus != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated was null, expected non-null MediaStatus.'); api.onAdBreakStatusUpdated(arg_mediaStatus!); return; }); @@ -1298,7 +1426,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onMediaError', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onMediaError', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1311,17 +1440,21 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onProgressUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onProgressUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onProgressUpdated was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onProgressUpdated was null.'); final List args = (message as List?)!; final int? arg_progressMs = (args[0] as int?); - assert(arg_progressMs != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onProgressUpdated was null, expected non-null int.'); + assert(arg_progressMs != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onProgressUpdated was null, expected non-null int.'); final int? arg_durationMs = (args[1] as int?); - assert(arg_durationMs != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onProgressUpdated was null, expected non-null int.'); + assert(arg_durationMs != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onProgressUpdated was null, expected non-null int.'); api.onProgressUpdated(arg_progressMs!, arg_durationMs!); return; }); @@ -1329,23 +1462,30 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null.'); final List args = (message as List?)!; final String? arg_adBreakId = (args[0] as String?); - assert(arg_adBreakId != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null String.'); + assert(arg_adBreakId != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null String.'); final String? arg_adBreakClipId = (args[1] as String?); - assert(arg_adBreakClipId != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null String.'); + assert(arg_adBreakClipId != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null String.'); final int? arg_progressMs = (args[2] as int?); - assert(arg_progressMs != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null int.'); + assert(arg_progressMs != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null int.'); final int? arg_durationMs = (args[3] as int?); - assert(arg_durationMs != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null int.'); + assert(arg_durationMs != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null int.'); final int? arg_whenSkippableMs = (args[4] as int?); - assert(arg_whenSkippableMs != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null int.'); + assert(arg_whenSkippableMs != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.onAdBreakClipProgressUpdated was null, expected non-null int.'); api.onAdBreakClipProgressUpdated(arg_adBreakId!, arg_adBreakClipId!, arg_progressMs!, arg_durationMs!, arg_whenSkippableMs!); return; }); @@ -1353,17 +1493,21 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange was null.'); final List args = (message as List?)!; final int? arg_insertIndex = (args[0] as int?); - assert(arg_insertIndex != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange was null, expected non-null int.'); + assert(arg_insertIndex != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange was null, expected non-null int.'); final int? arg_insertCount = (args[1] as int?); - assert(arg_insertCount != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange was null, expected non-null int.'); + assert(arg_insertCount != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsInsertedInRange was null, expected non-null int.'); api.itemsInsertedInRange(arg_insertIndex!, arg_insertCount!); return; }); @@ -1371,7 +1515,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.itemsReloaded', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.itemsReloaded', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1384,15 +1529,18 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes was null.'); final List args = (message as List?)!; final List? arg_indexes = (args[0] as List?)?.cast(); - assert(arg_indexes != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes was null, expected non-null List.'); + assert(arg_indexes != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsRemovedAtIndexes was null, expected non-null List.'); api.itemsRemovedAtIndexes(arg_indexes!); return; }); @@ -1400,17 +1548,21 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes was null.'); final List args = (message as List?)!; final List? arg_indexes = (args[0] as List?)?.cast(); - assert(arg_indexes != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes was null, expected non-null List.'); + assert(arg_indexes != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes was null, expected non-null List.'); final int? arg_insertBeforeIndex = (args[1] as int?); - assert(arg_insertBeforeIndex != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes was null, expected non-null int.'); + assert(arg_insertBeforeIndex != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsReorderedAtIndexes was null, expected non-null int.'); api.itemsReorderedAtIndexes(arg_indexes!, arg_insertBeforeIndex!); return; }); @@ -1418,15 +1570,18 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { - assert(message != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes was null.'); + assert(message != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes was null.'); final List args = (message as List?)!; final List? arg_indexes = (args[0] as List?)?.cast(); - assert(arg_indexes != null, 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes was null, expected non-null List.'); + assert(arg_indexes != null, + 'Argument for dev.flutter.pigeon.CastFlutterApi.itemsUpdatedAtIndexes was null, expected non-null List.'); api.itemsUpdatedAtIndexes(arg_indexes!); return; }); @@ -1434,7 +1589,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.mediaQueueChanged', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.mediaQueueChanged', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { @@ -1447,7 +1603,8 @@ abstract class CastFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CastFlutterApi.mediaQueueWillChange', codec, binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.CastFlutterApi.mediaQueueWillChange', codec, + binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { diff --git a/pubspec.lock b/pubspec.lock index deed9bf..9766054 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -251,6 +251,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.3" + recase: + dependency: "direct main" + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 32abef3..e501dad 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: sdk: flutter flutter_svg: ^2.0.4 meta: ^1.8.0 + recase: ^4.1.0 dev_dependencies: dartdoc: ^6.2.0