RemoteMediaClient Pigeons
This commit is contained in:
parent
a9b206e2cd
commit
278d98f69c
5 changed files with 910 additions and 136 deletions
|
|
@ -19,6 +19,296 @@ import java.util.HashMap;
|
|||
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
|
||||
public class PlatformBridgeApis {
|
||||
|
||||
public enum StreamType {
|
||||
invalid(0),
|
||||
none(1),
|
||||
buffered(2),
|
||||
live(3);
|
||||
|
||||
private int index;
|
||||
private StreamType(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
public enum MediaType {
|
||||
generic(0),
|
||||
movie(1),
|
||||
tvShow(2),
|
||||
musicTrack(3),
|
||||
photo(4),
|
||||
audiobookChapter(5),
|
||||
user(6);
|
||||
|
||||
private int index;
|
||||
private MediaType(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
private int index;
|
||||
private MediaMetadataKey(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TrackType {
|
||||
unknown(0),
|
||||
text(1),
|
||||
audio(2),
|
||||
video(3);
|
||||
|
||||
private int index;
|
||||
private TrackType(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TrackSubtype {
|
||||
unknown(0),
|
||||
none(1),
|
||||
subtitles(2),
|
||||
captions(3),
|
||||
descriptions(4),
|
||||
chapters(5),
|
||||
metadata(6);
|
||||
|
||||
private int index;
|
||||
private TrackSubtype(final int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class MediaLoadRequestData {
|
||||
private Boolean shouldAutoplay;
|
||||
public Boolean getShouldAutoplay() { return shouldAutoplay; }
|
||||
public void setShouldAutoplay(Boolean setterArg) { this.shouldAutoplay = setterArg; }
|
||||
|
||||
private Long currentTime;
|
||||
public Long getCurrentTime() { return currentTime; }
|
||||
public void setCurrentTime(Long setterArg) { this.currentTime = setterArg; }
|
||||
|
||||
private MediaInfo mediaInfo;
|
||||
public MediaInfo getMediaInfo() { return mediaInfo; }
|
||||
public void setMediaInfo(MediaInfo setterArg) { this.mediaInfo = setterArg; }
|
||||
|
||||
Map<String, Object> toMap() {
|
||||
Map<String, Object> toMapResult = new HashMap<>();
|
||||
toMapResult.put("shouldAutoplay", shouldAutoplay);
|
||||
toMapResult.put("currentTime", currentTime);
|
||||
toMapResult.put("mediaInfo", (mediaInfo == null) ? null : mediaInfo.toMap());
|
||||
return toMapResult;
|
||||
}
|
||||
static MediaLoadRequestData fromMap(Map<String, Object> map) {
|
||||
MediaLoadRequestData fromMapResult = new MediaLoadRequestData();
|
||||
Object shouldAutoplay = map.get("shouldAutoplay");
|
||||
fromMapResult.shouldAutoplay = (Boolean)shouldAutoplay;
|
||||
Object currentTime = map.get("currentTime");
|
||||
fromMapResult.currentTime = (currentTime == null) ? null : ((currentTime instanceof Integer) ? (Integer)currentTime : (Long)currentTime);
|
||||
Object mediaInfo = map.get("mediaInfo");
|
||||
fromMapResult.mediaInfo = MediaInfo.fromMap((Map)mediaInfo);
|
||||
return fromMapResult;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class MediaInfo {
|
||||
private String contentId;
|
||||
public String getContentId() { return contentId; }
|
||||
public void setContentId(String setterArg) { this.contentId = setterArg; }
|
||||
|
||||
private StreamType streamType;
|
||||
public StreamType getStreamType() { return streamType; }
|
||||
public void setStreamType(StreamType setterArg) { this.streamType = setterArg; }
|
||||
|
||||
private String contentType;
|
||||
public String getContentType() { return contentType; }
|
||||
public void setContentType(String setterArg) { this.contentType = setterArg; }
|
||||
|
||||
private MediaMetadata mediaMetadata;
|
||||
public MediaMetadata getMediaMetadata() { return mediaMetadata; }
|
||||
public void setMediaMetadata(MediaMetadata setterArg) { this.mediaMetadata = setterArg; }
|
||||
|
||||
private List<MediaTrack> mediaTracks;
|
||||
public List<MediaTrack> getMediaTracks() { return mediaTracks; }
|
||||
public void setMediaTracks(List<MediaTrack> setterArg) { this.mediaTracks = setterArg; }
|
||||
|
||||
private Long streamDuration;
|
||||
public Long getStreamDuration() { return streamDuration; }
|
||||
public void setStreamDuration(Long setterArg) { this.streamDuration = setterArg; }
|
||||
|
||||
private String customDataAsJson;
|
||||
public String getCustomDataAsJson() { return customDataAsJson; }
|
||||
public void setCustomDataAsJson(String setterArg) { this.customDataAsJson = setterArg; }
|
||||
|
||||
Map<String, Object> toMap() {
|
||||
Map<String, Object> toMapResult = new HashMap<>();
|
||||
toMapResult.put("contentId", contentId);
|
||||
toMapResult.put("streamType", streamType.index);
|
||||
toMapResult.put("contentType", contentType);
|
||||
toMapResult.put("mediaMetadata", (mediaMetadata == null) ? null : mediaMetadata.toMap());
|
||||
toMapResult.put("mediaTracks", mediaTracks);
|
||||
toMapResult.put("streamDuration", streamDuration);
|
||||
toMapResult.put("customDataAsJson", customDataAsJson);
|
||||
return toMapResult;
|
||||
}
|
||||
static MediaInfo fromMap(Map<String, Object> map) {
|
||||
MediaInfo fromMapResult = new MediaInfo();
|
||||
Object contentId = map.get("contentId");
|
||||
fromMapResult.contentId = (String)contentId;
|
||||
Object streamType = map.get("streamType");
|
||||
fromMapResult.streamType = StreamType.values()[(int)streamType];
|
||||
Object contentType = map.get("contentType");
|
||||
fromMapResult.contentType = (String)contentType;
|
||||
Object mediaMetadata = map.get("mediaMetadata");
|
||||
fromMapResult.mediaMetadata = MediaMetadata.fromMap((Map)mediaMetadata);
|
||||
Object mediaTracks = map.get("mediaTracks");
|
||||
fromMapResult.mediaTracks = (List<MediaTrack>)mediaTracks;
|
||||
Object streamDuration = map.get("streamDuration");
|
||||
fromMapResult.streamDuration = (streamDuration == null) ? null : ((streamDuration instanceof Integer) ? (Integer)streamDuration : (Long)streamDuration);
|
||||
Object customDataAsJson = map.get("customDataAsJson");
|
||||
fromMapResult.customDataAsJson = (String)customDataAsJson;
|
||||
return fromMapResult;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class MediaMetadata {
|
||||
private MediaType mediaType;
|
||||
public MediaType getMediaType() { return mediaType; }
|
||||
public void setMediaType(MediaType setterArg) { this.mediaType = setterArg; }
|
||||
|
||||
private Map<MediaMetadataKey, String> strings;
|
||||
public Map<MediaMetadataKey, String> getStrings() { return strings; }
|
||||
public void setStrings(Map<MediaMetadataKey, String> setterArg) { this.strings = setterArg; }
|
||||
|
||||
private List<WebImage> webImages;
|
||||
public List<WebImage> getWebImages() { return webImages; }
|
||||
public void setWebImages(List<WebImage> setterArg) { this.webImages = setterArg; }
|
||||
|
||||
Map<String, Object> toMap() {
|
||||
Map<String, Object> toMapResult = new HashMap<>();
|
||||
toMapResult.put("mediaType", mediaType.index);
|
||||
toMapResult.put("strings", strings);
|
||||
toMapResult.put("webImages", webImages);
|
||||
return toMapResult;
|
||||
}
|
||||
static MediaMetadata fromMap(Map<String, Object> map) {
|
||||
MediaMetadata fromMapResult = new MediaMetadata();
|
||||
Object mediaType = map.get("mediaType");
|
||||
fromMapResult.mediaType = MediaType.values()[(int)mediaType];
|
||||
Object strings = map.get("strings");
|
||||
fromMapResult.strings = (Map<MediaMetadataKey, String>)strings;
|
||||
Object webImages = map.get("webImages");
|
||||
fromMapResult.webImages = (List<WebImage>)webImages;
|
||||
return fromMapResult;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class WebImage {
|
||||
private String url;
|
||||
public String getUrl() { return url; }
|
||||
public void setUrl(String setterArg) { this.url = setterArg; }
|
||||
|
||||
Map<String, Object> toMap() {
|
||||
Map<String, Object> toMapResult = new HashMap<>();
|
||||
toMapResult.put("url", url);
|
||||
return toMapResult;
|
||||
}
|
||||
static WebImage fromMap(Map<String, Object> map) {
|
||||
WebImage fromMapResult = new WebImage();
|
||||
Object url = map.get("url");
|
||||
fromMapResult.url = (String)url;
|
||||
return fromMapResult;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class MediaTrack {
|
||||
private Long id;
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long setterArg) { this.id = setterArg; }
|
||||
|
||||
private TrackType trackType;
|
||||
public TrackType getTrackType() { return trackType; }
|
||||
public void setTrackType(TrackType setterArg) { this.trackType = setterArg; }
|
||||
|
||||
private String name;
|
||||
public String getName() { return name; }
|
||||
public void setName(String setterArg) { this.name = setterArg; }
|
||||
|
||||
private TrackSubtype trackSubtype;
|
||||
public TrackSubtype getTrackSubtype() { return trackSubtype; }
|
||||
public void setTrackSubtype(TrackSubtype setterArg) { this.trackSubtype = setterArg; }
|
||||
|
||||
private String contentId;
|
||||
public String getContentId() { return contentId; }
|
||||
public void setContentId(String setterArg) { this.contentId = setterArg; }
|
||||
|
||||
private String language;
|
||||
public String getLanguage() { return language; }
|
||||
public void setLanguage(String setterArg) { this.language = setterArg; }
|
||||
|
||||
Map<String, Object> toMap() {
|
||||
Map<String, Object> toMapResult = new HashMap<>();
|
||||
toMapResult.put("id", id);
|
||||
toMapResult.put("trackType", trackType.index);
|
||||
toMapResult.put("name", name);
|
||||
toMapResult.put("trackSubtype", trackSubtype.index);
|
||||
toMapResult.put("contentId", contentId);
|
||||
toMapResult.put("language", language);
|
||||
return toMapResult;
|
||||
}
|
||||
static MediaTrack fromMap(Map<String, Object> map) {
|
||||
MediaTrack fromMapResult = new MediaTrack();
|
||||
Object id = map.get("id");
|
||||
fromMapResult.id = (id == null) ? null : ((id instanceof Integer) ? (Integer)id : (Long)id);
|
||||
Object trackType = map.get("trackType");
|
||||
fromMapResult.trackType = TrackType.values()[(int)trackType];
|
||||
Object name = map.get("name");
|
||||
fromMapResult.name = (String)name;
|
||||
Object trackSubtype = map.get("trackSubtype");
|
||||
fromMapResult.trackSubtype = TrackSubtype.values()[(int)trackSubtype];
|
||||
Object contentId = map.get("contentId");
|
||||
fromMapResult.contentId = (String)contentId;
|
||||
Object language = map.get("language");
|
||||
fromMapResult.language = (String)language;
|
||||
return fromMapResult;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class CastMessage {
|
||||
private String namespace;
|
||||
|
|
@ -53,6 +343,21 @@ public class PlatformBridgeApis {
|
|||
case (byte)128:
|
||||
return CastMessage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)129:
|
||||
return MediaInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)130:
|
||||
return MediaLoadRequestData.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)131:
|
||||
return MediaMetadata.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)132:
|
||||
return MediaTrack.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)133:
|
||||
return WebImage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
default:
|
||||
return super.readValueOfType(type, buffer);
|
||||
|
||||
|
|
@ -64,6 +369,26 @@ public class PlatformBridgeApis {
|
|||
stream.write(128);
|
||||
writeValue(stream, ((CastMessage) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaInfo) {
|
||||
stream.write(129);
|
||||
writeValue(stream, ((MediaInfo) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaLoadRequestData) {
|
||||
stream.write(130);
|
||||
writeValue(stream, ((MediaLoadRequestData) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaMetadata) {
|
||||
stream.write(131);
|
||||
writeValue(stream, ((MediaMetadata) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaTrack) {
|
||||
stream.write(132);
|
||||
writeValue(stream, ((MediaTrack) value).toMap());
|
||||
} else
|
||||
if (value instanceof WebImage) {
|
||||
stream.write(133);
|
||||
writeValue(stream, ((WebImage) value).toMap());
|
||||
} else
|
||||
{
|
||||
super.writeValue(stream, value);
|
||||
}
|
||||
|
|
@ -74,6 +399,7 @@ public class PlatformBridgeApis {
|
|||
public interface CastHostApi {
|
||||
void sendMessage(CastMessage message);
|
||||
void showCastDialog();
|
||||
void loadMediaLoadRequestData(MediaLoadRequestData request);
|
||||
|
||||
/** The codec used by CastHostApi. */
|
||||
static MessageCodec<Object> getCodec() {
|
||||
|
|
@ -125,6 +451,30 @@ public class PlatformBridgeApis {
|
|||
channel.setMessageHandler(null);
|
||||
}
|
||||
}
|
||||
{
|
||||
BasicMessageChannel<Object> channel =
|
||||
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData", getCodec());
|
||||
if (api != null) {
|
||||
channel.setMessageHandler((message, reply) -> {
|
||||
Map<String, Object> wrapped = new HashMap<>();
|
||||
try {
|
||||
ArrayList<Object> args = (ArrayList<Object>)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);
|
||||
});
|
||||
} else {
|
||||
channel.setMessageHandler(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private static class CastFlutterApiCodec extends StandardMessageCodec {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,113 @@
|
|||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, StreamType) {
|
||||
StreamTypeInvalid = 0,
|
||||
StreamTypeNone = 1,
|
||||
StreamTypeBuffered = 2,
|
||||
StreamTypeLive = 3,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MediaType) {
|
||||
MediaTypeGeneric = 0,
|
||||
MediaTypeMovie = 1,
|
||||
MediaTypeTvShow = 2,
|
||||
MediaTypeMusicTrack = 3,
|
||||
MediaTypePhoto = 4,
|
||||
MediaTypeAudiobookChapter = 5,
|
||||
MediaTypeUser = 6,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MediaMetadataKey) {
|
||||
MediaMetadataKeyAlbumArtist = 0,
|
||||
MediaMetadataKeyAlbumTitle = 1,
|
||||
MediaMetadataKeyArtist = 2,
|
||||
MediaMetadataKeyBookTitle = 3,
|
||||
MediaMetadataKeyBroadcastDate = 4,
|
||||
MediaMetadataKeyChapterNumber = 5,
|
||||
MediaMetadataKeyChapterTitle = 6,
|
||||
MediaMetadataKeyComposer = 7,
|
||||
MediaMetadataKeyCreationDate = 8,
|
||||
MediaMetadataKeyDiscNumber = 9,
|
||||
MediaMetadataKeyEpisodeNumber = 10,
|
||||
MediaMetadataKeyHeight = 11,
|
||||
MediaMetadataKeyLocationLatitude = 12,
|
||||
MediaMetadataKeyLocationLongitude = 13,
|
||||
MediaMetadataKeyLocationName = 14,
|
||||
MediaMetadataKeyQueueItemId = 15,
|
||||
MediaMetadataKeyReleaseDate = 16,
|
||||
MediaMetadataKeySeasonNumber = 17,
|
||||
MediaMetadataKeySectionDuration = 18,
|
||||
MediaMetadataKeySectionStartAbsoluteTime = 19,
|
||||
MediaMetadataKeySectionStartTimeInContainer = 20,
|
||||
MediaMetadataKeySectionStartTimeInMedia = 21,
|
||||
MediaMetadataKeySeriesTitle = 22,
|
||||
MediaMetadataKeyStudio = 23,
|
||||
MediaMetadataKeySubtitle = 24,
|
||||
MediaMetadataKeyTitle = 25,
|
||||
MediaMetadataKeyTrackNumber = 26,
|
||||
MediaMetadataKeyWidth = 27,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, TrackType) {
|
||||
TrackTypeUnknown = 0,
|
||||
TrackTypeText = 1,
|
||||
TrackTypeAudio = 2,
|
||||
TrackTypeVideo = 3,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, TrackSubtype) {
|
||||
TrackSubtypeUnknown = 0,
|
||||
TrackSubtypeNone = 1,
|
||||
TrackSubtypeSubtitles = 2,
|
||||
TrackSubtypeCaptions = 3,
|
||||
TrackSubtypeDescriptions = 4,
|
||||
TrackSubtypeChapters = 5,
|
||||
TrackSubtypeMetadata = 6,
|
||||
};
|
||||
|
||||
@class MediaLoadRequestData;
|
||||
@class MediaInfo;
|
||||
@class MediaMetadata;
|
||||
@class WebImage;
|
||||
@class MediaTrack;
|
||||
@class CastMessage;
|
||||
|
||||
@interface MediaLoadRequestData : NSObject
|
||||
@property(nonatomic, strong, nullable) NSNumber * shouldAutoplay;
|
||||
@property(nonatomic, strong, nullable) NSNumber * currentTime;
|
||||
@property(nonatomic, strong, nullable) MediaInfo * mediaInfo;
|
||||
@end
|
||||
|
||||
@interface MediaInfo : NSObject
|
||||
@property(nonatomic, copy, nullable) NSString * contentId;
|
||||
@property(nonatomic, assign) StreamType streamType;
|
||||
@property(nonatomic, copy, nullable) NSString * contentType;
|
||||
@property(nonatomic, strong, nullable) MediaMetadata * mediaMetadata;
|
||||
@property(nonatomic, strong, nullable) NSArray<MediaTrack *> * mediaTracks;
|
||||
@property(nonatomic, strong, nullable) NSNumber * streamDuration;
|
||||
@property(nonatomic, copy, nullable) NSString * customDataAsJson;
|
||||
@end
|
||||
|
||||
@interface MediaMetadata : NSObject
|
||||
@property(nonatomic, assign) MediaType mediaType;
|
||||
@property(nonatomic, strong, nullable) NSDictionary<MediaMetadataKey *, NSString *> * strings;
|
||||
@property(nonatomic, strong, nullable) NSArray<WebImage *> * webImages;
|
||||
@end
|
||||
|
||||
@interface WebImage : NSObject
|
||||
@property(nonatomic, copy, nullable) NSString * url;
|
||||
@end
|
||||
|
||||
@interface MediaTrack : NSObject
|
||||
@property(nonatomic, strong, nullable) NSNumber * id;
|
||||
@property(nonatomic, assign) TrackType trackType;
|
||||
@property(nonatomic, copy, nullable) NSString * name;
|
||||
@property(nonatomic, assign) TrackSubtype trackSubtype;
|
||||
@property(nonatomic, copy, nullable) NSString * contentId;
|
||||
@property(nonatomic, copy, nullable) NSString * language;
|
||||
@end
|
||||
|
||||
@interface CastMessage : NSObject
|
||||
@property(nonatomic, copy, nullable) NSString * namespace;
|
||||
@property(nonatomic, copy, nullable) NSString * message;
|
||||
|
|
@ -21,6 +126,7 @@ NSObject<FlutterMessageCodec> *CastHostApiGetCodec(void);
|
|||
@protocol CastHostApi
|
||||
- (void)sendMessageMessage:(CastMessage *)message error:(FlutterError *_Nullable *_Nonnull)error;
|
||||
- (void)showCastDialogWithError:(FlutterError *_Nullable *_Nonnull)error;
|
||||
- (void)loadMediaLoadRequestDataRequest:(MediaLoadRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error;
|
||||
@end
|
||||
|
||||
extern void CastHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<CastHostApi> *_Nullable api);
|
||||
|
|
|
|||
|
|
@ -22,11 +22,149 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
};
|
||||
}
|
||||
|
||||
@interface MediaLoadRequestData ()
|
||||
+ (MediaLoadRequestData *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface MediaInfo ()
|
||||
+ (MediaInfo *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface MediaMetadata ()
|
||||
+ (MediaMetadata *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface WebImage ()
|
||||
+ (WebImage *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface MediaTrack ()
|
||||
+ (MediaTrack *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface CastMessage ()
|
||||
+ (CastMessage *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
|
||||
@implementation MediaLoadRequestData
|
||||
+ (MediaLoadRequestData *)fromMap:(NSDictionary *)dict {
|
||||
MediaLoadRequestData *result = [[MediaLoadRequestData alloc] init];
|
||||
result.shouldAutoplay = dict[@"shouldAutoplay"];
|
||||
if ((NSNull *)result.shouldAutoplay == [NSNull null]) {
|
||||
result.shouldAutoplay = nil;
|
||||
}
|
||||
result.currentTime = dict[@"currentTime"];
|
||||
if ((NSNull *)result.currentTime == [NSNull null]) {
|
||||
result.currentTime = nil;
|
||||
}
|
||||
result.mediaInfo = [MediaInfo fromMap:dict[@"mediaInfo"]];
|
||||
if ((NSNull *)result.mediaInfo == [NSNull null]) {
|
||||
result.mediaInfo = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:(self.shouldAutoplay ? self.shouldAutoplay : [NSNull null]), @"shouldAutoplay", (self.currentTime ? self.currentTime : [NSNull null]), @"currentTime", (self.mediaInfo ? [self.mediaInfo toMap] : [NSNull null]), @"mediaInfo", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation MediaInfo
|
||||
+ (MediaInfo *)fromMap:(NSDictionary *)dict {
|
||||
MediaInfo *result = [[MediaInfo alloc] init];
|
||||
result.contentId = dict[@"contentId"];
|
||||
if ((NSNull *)result.contentId == [NSNull null]) {
|
||||
result.contentId = nil;
|
||||
}
|
||||
result.streamType = [dict[@"streamType"] integerValue];
|
||||
result.contentType = dict[@"contentType"];
|
||||
if ((NSNull *)result.contentType == [NSNull null]) {
|
||||
result.contentType = nil;
|
||||
}
|
||||
result.mediaMetadata = [MediaMetadata fromMap:dict[@"mediaMetadata"]];
|
||||
if ((NSNull *)result.mediaMetadata == [NSNull null]) {
|
||||
result.mediaMetadata = nil;
|
||||
}
|
||||
result.mediaTracks = dict[@"mediaTracks"];
|
||||
if ((NSNull *)result.mediaTracks == [NSNull null]) {
|
||||
result.mediaTracks = nil;
|
||||
}
|
||||
result.streamDuration = dict[@"streamDuration"];
|
||||
if ((NSNull *)result.streamDuration == [NSNull null]) {
|
||||
result.streamDuration = nil;
|
||||
}
|
||||
result.customDataAsJson = dict[@"customDataAsJson"];
|
||||
if ((NSNull *)result.customDataAsJson == [NSNull null]) {
|
||||
result.customDataAsJson = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:(self.contentId ? self.contentId : [NSNull null]), @"contentId", @(self.streamType), @"streamType", (self.contentType ? self.contentType : [NSNull null]), @"contentType", (self.mediaMetadata ? [self.mediaMetadata toMap] : [NSNull null]), @"mediaMetadata", (self.mediaTracks ? self.mediaTracks : [NSNull null]), @"mediaTracks", (self.streamDuration ? self.streamDuration : [NSNull null]), @"streamDuration", (self.customDataAsJson ? self.customDataAsJson : [NSNull null]), @"customDataAsJson", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation MediaMetadata
|
||||
+ (MediaMetadata *)fromMap:(NSDictionary *)dict {
|
||||
MediaMetadata *result = [[MediaMetadata alloc] init];
|
||||
result.mediaType = [dict[@"mediaType"] integerValue];
|
||||
result.strings = dict[@"strings"];
|
||||
if ((NSNull *)result.strings == [NSNull null]) {
|
||||
result.strings = nil;
|
||||
}
|
||||
result.webImages = dict[@"webImages"];
|
||||
if ((NSNull *)result.webImages == [NSNull null]) {
|
||||
result.webImages = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:@(self.mediaType), @"mediaType", (self.strings ? self.strings : [NSNull null]), @"strings", (self.webImages ? self.webImages : [NSNull null]), @"webImages", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation WebImage
|
||||
+ (WebImage *)fromMap:(NSDictionary *)dict {
|
||||
WebImage *result = [[WebImage alloc] init];
|
||||
result.url = dict[@"url"];
|
||||
if ((NSNull *)result.url == [NSNull null]) {
|
||||
result.url = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:(self.url ? self.url : [NSNull null]), @"url", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation MediaTrack
|
||||
+ (MediaTrack *)fromMap:(NSDictionary *)dict {
|
||||
MediaTrack *result = [[MediaTrack alloc] init];
|
||||
result.id = dict[@"id"];
|
||||
if ((NSNull *)result.id == [NSNull null]) {
|
||||
result.id = nil;
|
||||
}
|
||||
result.trackType = [dict[@"trackType"] integerValue];
|
||||
result.name = dict[@"name"];
|
||||
if ((NSNull *)result.name == [NSNull null]) {
|
||||
result.name = nil;
|
||||
}
|
||||
result.trackSubtype = [dict[@"trackSubtype"] integerValue];
|
||||
result.contentId = dict[@"contentId"];
|
||||
if ((NSNull *)result.contentId == [NSNull null]) {
|
||||
result.contentId = nil;
|
||||
}
|
||||
result.language = dict[@"language"];
|
||||
if ((NSNull *)result.language == [NSNull null]) {
|
||||
result.language = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:(self.id ? self.id : [NSNull null]), @"id", @(self.trackType), @"trackType", (self.name ? self.name : [NSNull null]), @"name", @(self.trackSubtype), @"trackSubtype", (self.contentId ? self.contentId : [NSNull null]), @"contentId", (self.language ? self.language : [NSNull null]), @"language", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation CastMessage
|
||||
+ (CastMessage *)fromMap:(NSDictionary *)dict {
|
||||
CastMessage *result = [[CastMessage alloc] init];
|
||||
|
|
@ -54,6 +192,21 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
case 128:
|
||||
return [CastMessage fromMap:[self readValue]];
|
||||
|
||||
case 129:
|
||||
return [MediaInfo fromMap:[self readValue]];
|
||||
|
||||
case 130:
|
||||
return [MediaLoadRequestData fromMap:[self readValue]];
|
||||
|
||||
case 131:
|
||||
return [MediaMetadata fromMap:[self readValue]];
|
||||
|
||||
case 132:
|
||||
return [MediaTrack fromMap:[self readValue]];
|
||||
|
||||
case 133:
|
||||
return [WebImage fromMap:[self readValue]];
|
||||
|
||||
default:
|
||||
return [super readValueOfType:type];
|
||||
|
||||
|
|
@ -70,6 +223,26 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
[self writeByte:128];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaInfo class]]) {
|
||||
[self writeByte:129];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaLoadRequestData class]]) {
|
||||
[self writeByte:130];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaMetadata class]]) {
|
||||
[self writeByte:131];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaTrack class]]) {
|
||||
[self writeByte:132];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[WebImage class]]) {
|
||||
[self writeByte:133];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
{
|
||||
[super writeValue:value];
|
||||
}
|
||||
|
|
@ -137,6 +310,26 @@ void CastHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<CastH
|
|||
[channel setMessageHandler:nil];
|
||||
}
|
||||
}
|
||||
{
|
||||
FlutterBasicMessageChannel *channel =
|
||||
[FlutterBasicMessageChannel
|
||||
messageChannelWithName:@"dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData"
|
||||
binaryMessenger:binaryMessenger
|
||||
codec:CastHostApiGetCodec()];
|
||||
if (api) {
|
||||
NSCAssert([api respondsToSelector:@selector(loadMediaLoadRequestDataRequest:error:)], @"CastHostApi api (%@) doesn't respond to @selector(loadMediaLoadRequestDataRequest:error:)", api);
|
||||
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
|
||||
NSArray *args = message;
|
||||
MediaLoadRequestData *arg_request = args[0];
|
||||
FlutterError *error;
|
||||
[api loadMediaLoadRequestDataRequest:arg_request error:&error];
|
||||
callback(wrapResult(nil, error));
|
||||
}];
|
||||
}
|
||||
else {
|
||||
[channel setMessageHandler:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
@interface CastFlutterApiCodecReader : FlutterStandardReader
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -8,6 +8,208 @@ import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
|
|||
import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
enum StreamType {
|
||||
invalid,
|
||||
none,
|
||||
buffered,
|
||||
live,
|
||||
}
|
||||
|
||||
enum MediaType {
|
||||
generic,
|
||||
movie,
|
||||
tvShow,
|
||||
musicTrack,
|
||||
photo,
|
||||
audiobookChapter,
|
||||
user,
|
||||
}
|
||||
|
||||
enum MediaMetadataKey {
|
||||
albumArtist,
|
||||
albumTitle,
|
||||
artist,
|
||||
bookTitle,
|
||||
broadcastDate,
|
||||
chapterNumber,
|
||||
chapterTitle,
|
||||
composer,
|
||||
creationDate,
|
||||
discNumber,
|
||||
episodeNumber,
|
||||
height,
|
||||
locationLatitude,
|
||||
locationLongitude,
|
||||
locationName,
|
||||
queueItemId,
|
||||
releaseDate,
|
||||
seasonNumber,
|
||||
sectionDuration,
|
||||
sectionStartAbsoluteTime,
|
||||
sectionStartTimeInContainer,
|
||||
sectionStartTimeInMedia,
|
||||
seriesTitle,
|
||||
studio,
|
||||
subtitle,
|
||||
title,
|
||||
trackNumber,
|
||||
width,
|
||||
}
|
||||
|
||||
enum TrackType {
|
||||
unknown,
|
||||
text,
|
||||
audio,
|
||||
video,
|
||||
}
|
||||
|
||||
enum TrackSubtype {
|
||||
unknown,
|
||||
none,
|
||||
subtitles,
|
||||
captions,
|
||||
descriptions,
|
||||
chapters,
|
||||
metadata,
|
||||
}
|
||||
|
||||
class MediaLoadRequestData {
|
||||
bool? shouldAutoplay;
|
||||
int? currentTime;
|
||||
MediaInfo? mediaInfo;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
pigeonMap['shouldAutoplay'] = shouldAutoplay;
|
||||
pigeonMap['currentTime'] = currentTime;
|
||||
pigeonMap['mediaInfo'] = mediaInfo == null ? null : mediaInfo!.encode();
|
||||
return pigeonMap;
|
||||
}
|
||||
|
||||
static MediaLoadRequestData decode(Object message) {
|
||||
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
|
||||
return MediaLoadRequestData()
|
||||
..shouldAutoplay = pigeonMap['shouldAutoplay'] as bool?
|
||||
..currentTime = pigeonMap['currentTime'] as int?
|
||||
..mediaInfo = pigeonMap['mediaInfo'] != null
|
||||
? MediaInfo.decode(pigeonMap['mediaInfo']!)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
class MediaInfo {
|
||||
String? contentId;
|
||||
StreamType? streamType;
|
||||
String? contentType;
|
||||
MediaMetadata? mediaMetadata;
|
||||
List<MediaTrack?>? mediaTracks;
|
||||
int? streamDuration;
|
||||
String? customDataAsJson;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
pigeonMap['contentId'] = contentId;
|
||||
pigeonMap['streamType'] = streamType == null ? null : streamType!.index;
|
||||
pigeonMap['contentType'] = contentType;
|
||||
pigeonMap['mediaMetadata'] = mediaMetadata == null ? null : mediaMetadata!.encode();
|
||||
pigeonMap['mediaTracks'] = mediaTracks;
|
||||
pigeonMap['streamDuration'] = streamDuration;
|
||||
pigeonMap['customDataAsJson'] = customDataAsJson;
|
||||
return pigeonMap;
|
||||
}
|
||||
|
||||
static MediaInfo decode(Object message) {
|
||||
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
|
||||
return MediaInfo()
|
||||
..contentId = pigeonMap['contentId'] as String?
|
||||
..streamType = pigeonMap['streamType'] != null
|
||||
? StreamType.values[pigeonMap['streamType']! as int]
|
||||
: null
|
||||
..contentType = pigeonMap['contentType'] as String?
|
||||
..mediaMetadata = pigeonMap['mediaMetadata'] != null
|
||||
? MediaMetadata.decode(pigeonMap['mediaMetadata']!)
|
||||
: null
|
||||
..mediaTracks = (pigeonMap['mediaTracks'] as List<Object?>?)?.cast<MediaTrack?>()
|
||||
..streamDuration = pigeonMap['streamDuration'] as int?
|
||||
..customDataAsJson = pigeonMap['customDataAsJson'] as String?;
|
||||
}
|
||||
}
|
||||
|
||||
class MediaMetadata {
|
||||
MediaType? mediaType;
|
||||
Map<MediaMetadataKey?, String?>? strings;
|
||||
List<WebImage?>? webImages;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
pigeonMap['mediaType'] = mediaType == null ? null : mediaType!.index;
|
||||
pigeonMap['strings'] = strings;
|
||||
pigeonMap['webImages'] = webImages;
|
||||
return pigeonMap;
|
||||
}
|
||||
|
||||
static MediaMetadata decode(Object message) {
|
||||
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
|
||||
return MediaMetadata()
|
||||
..mediaType = pigeonMap['mediaType'] != null
|
||||
? MediaType.values[pigeonMap['mediaType']! as int]
|
||||
: null
|
||||
..strings = (pigeonMap['strings'] as Map<Object?, Object?>?)?.cast<MediaMetadataKey?, String?>()
|
||||
..webImages = (pigeonMap['webImages'] as List<Object?>?)?.cast<WebImage?>();
|
||||
}
|
||||
}
|
||||
|
||||
class WebImage {
|
||||
String? url;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
pigeonMap['url'] = url;
|
||||
return pigeonMap;
|
||||
}
|
||||
|
||||
static WebImage decode(Object message) {
|
||||
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
|
||||
return WebImage()
|
||||
..url = pigeonMap['url'] as String?;
|
||||
}
|
||||
}
|
||||
|
||||
class MediaTrack {
|
||||
int? id;
|
||||
TrackType? trackType;
|
||||
String? name;
|
||||
TrackSubtype? trackSubtype;
|
||||
String? contentId;
|
||||
String? language;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
pigeonMap['id'] = id;
|
||||
pigeonMap['trackType'] = trackType == null ? null : trackType!.index;
|
||||
pigeonMap['name'] = name;
|
||||
pigeonMap['trackSubtype'] = trackSubtype == null ? null : trackSubtype!.index;
|
||||
pigeonMap['contentId'] = contentId;
|
||||
pigeonMap['language'] = language;
|
||||
return pigeonMap;
|
||||
}
|
||||
|
||||
static MediaTrack decode(Object message) {
|
||||
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
|
||||
return MediaTrack()
|
||||
..id = pigeonMap['id'] as int?
|
||||
..trackType = pigeonMap['trackType'] != null
|
||||
? TrackType.values[pigeonMap['trackType']! as int]
|
||||
: null
|
||||
..name = pigeonMap['name'] as String?
|
||||
..trackSubtype = pigeonMap['trackSubtype'] != null
|
||||
? TrackSubtype.values[pigeonMap['trackSubtype']! as int]
|
||||
: null
|
||||
..contentId = pigeonMap['contentId'] as String?
|
||||
..language = pigeonMap['language'] as String?;
|
||||
}
|
||||
}
|
||||
|
||||
class CastMessage {
|
||||
String? namespace;
|
||||
String? message;
|
||||
|
|
@ -35,6 +237,26 @@ class _CastHostApiCodec extends StandardMessageCodec {
|
|||
buffer.putUint8(128);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaInfo) {
|
||||
buffer.putUint8(129);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaLoadRequestData) {
|
||||
buffer.putUint8(130);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaMetadata) {
|
||||
buffer.putUint8(131);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaTrack) {
|
||||
buffer.putUint8(132);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is WebImage) {
|
||||
buffer.putUint8(133);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
{
|
||||
super.writeValue(buffer, value);
|
||||
}
|
||||
|
|
@ -45,6 +267,21 @@ class _CastHostApiCodec extends StandardMessageCodec {
|
|||
case 128:
|
||||
return CastMessage.decode(readValue(buffer)!);
|
||||
|
||||
case 129:
|
||||
return MediaInfo.decode(readValue(buffer)!);
|
||||
|
||||
case 130:
|
||||
return MediaLoadRequestData.decode(readValue(buffer)!);
|
||||
|
||||
case 131:
|
||||
return MediaMetadata.decode(readValue(buffer)!);
|
||||
|
||||
case 132:
|
||||
return MediaTrack.decode(readValue(buffer)!);
|
||||
|
||||
case 133:
|
||||
return WebImage.decode(readValue(buffer)!);
|
||||
|
||||
default:
|
||||
return super.readValueOfType(type, buffer);
|
||||
|
||||
|
|
@ -107,6 +344,29 @@ class CastHostApi {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadMediaLoadRequestData(MediaLoadRequestData arg_request) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.CastHostApi.loadMediaLoadRequestData', codec, binaryMessenger: _binaryMessenger);
|
||||
final Map<Object?, Object?>? replyMap =
|
||||
await channel.send(<Object>[arg_request]) as Map<Object?, Object?>?;
|
||||
if (replyMap == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
details: null,
|
||||
);
|
||||
} else if (replyMap['error'] != null) {
|
||||
final Map<Object?, Object?> error = (replyMap['error'] as Map<Object?, Object?>?)!;
|
||||
throw PlatformException(
|
||||
code: (error['code'] as String?)!,
|
||||
message: error['message'] as String?,
|
||||
details: error['details'],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _CastFlutterApiCodec extends StandardMessageCodec {
|
||||
|
|
|
|||
|
|
@ -38,21 +38,6 @@ enum StreamType {
|
|||
live,
|
||||
}
|
||||
|
||||
// extension StreamTypeExtension on StreamType {
|
||||
// int get intValue {
|
||||
// switch (this) {
|
||||
// case StreamType.invalid:
|
||||
// return -1;
|
||||
// case StreamType.none:
|
||||
// return 0;
|
||||
// case StreamType.buffered:
|
||||
// return 1;
|
||||
// case StreamType.live:
|
||||
// return 2;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata
|
||||
class MediaMetadata {
|
||||
MediaType? mediaType;
|
||||
|
|
@ -84,27 +69,6 @@ enum MediaType {
|
|||
user,
|
||||
}
|
||||
|
||||
// extension MediaTypeExtension on MediaType {
|
||||
// int get intValue {
|
||||
// switch (this) {
|
||||
// case MediaType.generic:
|
||||
// return 0;
|
||||
// case MediaType.movie:
|
||||
// return 1;
|
||||
// case MediaType.tvShow:
|
||||
// return 2;
|
||||
// case MediaType.musicTrack:
|
||||
// return 3;
|
||||
// case MediaType.photo:
|
||||
// return 4;
|
||||
// case MediaType.audiobookChapter:
|
||||
// return 5;
|
||||
// case MediaType.user:
|
||||
// return 100;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/common/images/WebImage
|
||||
class WebImage {
|
||||
String? url;
|
||||
|
|
@ -197,69 +161,6 @@ enum MediaMetadataKey {
|
|||
width,
|
||||
}
|
||||
|
||||
// extension MediaMetadataExtension on MediaMetadataKey {
|
||||
// String get stringValue {
|
||||
// switch (this) {
|
||||
// case MediaMetadataKey.albumArtist:
|
||||
// return "com.google.android.gms.cast.metadata.ALBUM_ARTIST";
|
||||
// case MediaMetadataKey.albumTitle:
|
||||
// return "com.google.android.gms.cast.metadata.ALBUM_TITLE";
|
||||
// case MediaMetadataKey.artist:
|
||||
// return "com.google.android.gms.cast.metadata.ARTIST";
|
||||
// case MediaMetadataKey.bookTitle:
|
||||
// return "com.google.android.gms.cast.metadata.BOOK_TITLE";
|
||||
// case MediaMetadataKey.broadcastDate:
|
||||
// return "com.google.android.gms.cast.metadata.BROADCAST_DATE";
|
||||
// case MediaMetadataKey.chapterNumber:
|
||||
// return "com.google.android.gms.cast.metadata.CHAPTER_NUMBER";
|
||||
// case MediaMetadataKey.chapterTitle:
|
||||
// return "com.google.android.gms.cast.metadata.CHAPTER_TITLE";
|
||||
// case MediaMetadataKey.composer:
|
||||
// return "com.google.android.gms.cast.metadata.COMPOSER";
|
||||
// case MediaMetadataKey.creationDate:
|
||||
// return "com.google.android.gms.cast.metadata.CREATION_DATE";
|
||||
// case MediaMetadataKey.discNumber:
|
||||
// return "com.google.android.gms.cast.metadata.DISC_NUMBER";
|
||||
// case MediaMetadataKey.episodeNumber:
|
||||
// return "com.google.android.gms.cast.metadata.EPISODE_NUMBER";
|
||||
// case MediaMetadataKey.height:
|
||||
// return "com.google.android.gms.cast.metadata.HEIGHT";
|
||||
// case MediaMetadataKey.locationLatitude:
|
||||
// return "com.google.android.gms.cast.metadata.LOCATION_LATITUDE";
|
||||
// case MediaMetadataKey.locationLongitude:
|
||||
// return "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE";
|
||||
// case MediaMetadataKey.locationName:
|
||||
// return "com.google.android.gms.cast.metadata.LOCATION_NAME";
|
||||
// case MediaMetadataKey.queueItemId:
|
||||
// return "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID";
|
||||
// case MediaMetadataKey.releaseDate:
|
||||
// return "com.google.android.gms.cast.metadata.RELEASE_DATE";
|
||||
// case MediaMetadataKey.seasonNumber:
|
||||
// return "com.google.android.gms.cast.metadata.SEASON_NUMBER";
|
||||
// case MediaMetadataKey.sectionDuration:
|
||||
// return "com.google.android.gms.cast.metadata.SECTION_DURATION";
|
||||
// case MediaMetadataKey.sectionStartAbsoluteTime:
|
||||
// return "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME";
|
||||
// case MediaMetadataKey.sectionStartTimeInContainer:
|
||||
// return "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER";
|
||||
// case MediaMetadataKey.sectionStartTimeInMedia:
|
||||
// return "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA";
|
||||
// case MediaMetadataKey.seriesTitle:
|
||||
// return "com.google.android.gms.cast.metadata.SERIES_TITLE";
|
||||
// case MediaMetadataKey.studio:
|
||||
// return "com.google.android.gms.cast.metadata.STUDIO";
|
||||
// case MediaMetadataKey.subtitle:
|
||||
// return "com.google.android.gms.cast.metadata.SUBTITLE";
|
||||
// case MediaMetadataKey.title:
|
||||
// return "com.google.android.gms.cast.metadata.TITLE";
|
||||
// case MediaMetadataKey.trackNumber:
|
||||
// return "com.google.android.gms.cast.metadata.TRACK_NUMBER";
|
||||
// case MediaMetadataKey.width:
|
||||
// return "com.google.android.gms.cast.metadata.WIDTH";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack
|
||||
class MediaTrack {
|
||||
int? id;
|
||||
|
|
@ -267,7 +168,7 @@ class MediaTrack {
|
|||
String? name;
|
||||
TrackSubtype? trackSubtype;
|
||||
String? contentId;
|
||||
String? langiage;
|
||||
String? language;
|
||||
}
|
||||
|
||||
/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack
|
||||
|
|
@ -285,21 +186,6 @@ enum TrackType {
|
|||
video,
|
||||
}
|
||||
|
||||
// extension TrackTypeExtension on TrackType {
|
||||
// int get intValue {
|
||||
// switch (this) {
|
||||
// case TrackType.unknown:
|
||||
// return 0;
|
||||
// case TrackType.text:
|
||||
// return 1;
|
||||
// case TrackType.audio:
|
||||
// return 2;
|
||||
// case TrackType.video:
|
||||
// return 3;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaTrack
|
||||
enum TrackSubtype {
|
||||
/// A media track subtype indicating an unknown subtype.
|
||||
|
|
@ -324,27 +210,6 @@ enum TrackSubtype {
|
|||
metadata,
|
||||
}
|
||||
|
||||
// extension TrackSubtypeExtension on TrackSubtype {
|
||||
// int get intValue {
|
||||
// switch (this) {
|
||||
// case TrackSubtype.unknown:
|
||||
// return -1;
|
||||
// case TrackSubtype.none:
|
||||
// return 0;
|
||||
// case TrackSubtype.subtitles:
|
||||
// return 1;
|
||||
// case TrackSubtype.captions:
|
||||
// return 2;
|
||||
// case TrackSubtype.descriptions:
|
||||
// return 3;
|
||||
// case TrackSubtype.chapters:
|
||||
// return 4;
|
||||
// case TrackSubtype.metadata:
|
||||
// return 5;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//#endregion
|
||||
|
||||
class CastMessage {
|
||||
|
|
|
|||
Loading…
Reference in a new issue