AdBreakClipInfo pigeon, android, ios, flutter
This commit is contained in:
parent
778081927f
commit
ad37766f94
7 changed files with 385 additions and 80 deletions
|
|
@ -146,6 +146,10 @@ public class PlatformBridgeApis {
|
|||
public Long getStreamDuration() { return streamDuration; }
|
||||
public void setStreamDuration(Long setterArg) { this.streamDuration = setterArg; }
|
||||
|
||||
private List<AdBreakClipInfo> adBreakClips;
|
||||
public List<AdBreakClipInfo> getAdBreakClips() { return adBreakClips; }
|
||||
public void setAdBreakClips(List<AdBreakClipInfo> setterArg) { this.adBreakClips = setterArg; }
|
||||
|
||||
private String customDataAsJson;
|
||||
public String getCustomDataAsJson() { return customDataAsJson; }
|
||||
public void setCustomDataAsJson(String setterArg) { this.customDataAsJson = setterArg; }
|
||||
|
|
@ -158,6 +162,7 @@ public class PlatformBridgeApis {
|
|||
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;
|
||||
}
|
||||
|
|
@ -175,6 +180,8 @@ public class PlatformBridgeApis {
|
|||
fromMapResult.mediaTracks = (List<MediaTrack>)mediaTracks;
|
||||
Object streamDuration = map.get("streamDuration");
|
||||
fromMapResult.streamDuration = (streamDuration == null) ? null : ((streamDuration instanceof Integer) ? (Integer)streamDuration : (Long)streamDuration);
|
||||
Object adBreakClips = map.get("adBreakClips");
|
||||
fromMapResult.adBreakClips = (List<AdBreakClipInfo>)adBreakClips;
|
||||
Object customDataAsJson = map.get("customDataAsJson");
|
||||
fromMapResult.customDataAsJson = (String)customDataAsJson;
|
||||
return fromMapResult;
|
||||
|
|
@ -353,6 +360,81 @@ public class PlatformBridgeApis {
|
|||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class AdBreakClipInfo {
|
||||
private String id;
|
||||
public String getId() { return id; }
|
||||
public void setId(String setterArg) { this.id = setterArg; }
|
||||
|
||||
private String title;
|
||||
public String getTitle() { return title; }
|
||||
public void setTitle(String setterArg) { this.title = setterArg; }
|
||||
|
||||
private String contentId;
|
||||
public String getContentId() { return contentId; }
|
||||
public void setContentId(String setterArg) { this.contentId = setterArg; }
|
||||
|
||||
private String contentUrl;
|
||||
public String getContentUrl() { return contentUrl; }
|
||||
public void setContentUrl(String setterArg) { this.contentUrl = setterArg; }
|
||||
|
||||
private String clickThroughUrl;
|
||||
public String getClickThroughUrl() { return clickThroughUrl; }
|
||||
public void setClickThroughUrl(String setterArg) { this.clickThroughUrl = setterArg; }
|
||||
|
||||
private Long durationMs;
|
||||
public Long getDurationMs() { return durationMs; }
|
||||
public void setDurationMs(Long setterArg) { this.durationMs = setterArg; }
|
||||
|
||||
private String imageUrl;
|
||||
public String getImageUrl() { return imageUrl; }
|
||||
public void setImageUrl(String setterArg) { this.imageUrl = setterArg; }
|
||||
|
||||
private String mimeType;
|
||||
public String getMimeType() { return mimeType; }
|
||||
public void setMimeType(String setterArg) { this.mimeType = setterArg; }
|
||||
|
||||
private Long whenSkippableMs;
|
||||
public Long getWhenSkippableMs() { return whenSkippableMs; }
|
||||
public void setWhenSkippableMs(Long setterArg) { this.whenSkippableMs = setterArg; }
|
||||
|
||||
Map<String, Object> toMap() {
|
||||
Map<String, Object> 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;
|
||||
}
|
||||
static AdBreakClipInfo fromMap(Map<String, Object> map) {
|
||||
AdBreakClipInfo fromMapResult = new AdBreakClipInfo();
|
||||
Object id = map.get("id");
|
||||
fromMapResult.id = (String)id;
|
||||
Object title = map.get("title");
|
||||
fromMapResult.title = (String)title;
|
||||
Object contentId = map.get("contentId");
|
||||
fromMapResult.contentId = (String)contentId;
|
||||
Object contentUrl = map.get("contentUrl");
|
||||
fromMapResult.contentUrl = (String)contentUrl;
|
||||
Object clickThroughUrl = map.get("clickThroughUrl");
|
||||
fromMapResult.clickThroughUrl = (String)clickThroughUrl;
|
||||
Object durationMs = map.get("durationMs");
|
||||
fromMapResult.durationMs = (durationMs == null) ? null : ((durationMs instanceof Integer) ? (Integer)durationMs : (Long)durationMs);
|
||||
Object imageUrl = map.get("imageUrl");
|
||||
fromMapResult.imageUrl = (String)imageUrl;
|
||||
Object mimeType = map.get("mimeType");
|
||||
fromMapResult.mimeType = (String)mimeType;
|
||||
Object whenSkippableMs = map.get("whenSkippableMs");
|
||||
fromMapResult.whenSkippableMs = (whenSkippableMs == null) ? null : ((whenSkippableMs instanceof Integer) ? (Integer)whenSkippableMs : (Long)whenSkippableMs);
|
||||
return fromMapResult;
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated class from Pigeon that represents data sent in messages. */
|
||||
public static class CastDevice {
|
||||
private String deviceId;
|
||||
|
|
@ -418,24 +500,27 @@ public class PlatformBridgeApis {
|
|||
protected Object readValueOfType(byte type, ByteBuffer buffer) {
|
||||
switch (type) {
|
||||
case (byte)128:
|
||||
return CastDevice.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return AdBreakClipInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)129:
|
||||
return CastMessage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return CastDevice.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)130:
|
||||
return MediaInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return CastMessage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)131:
|
||||
return MediaLoadRequestData.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return MediaInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)132:
|
||||
return MediaMetadata.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return MediaLoadRequestData.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)133:
|
||||
return MediaTrack.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return MediaMetadata.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)134:
|
||||
return MediaTrack.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)135:
|
||||
return WebImage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
default:
|
||||
|
|
@ -445,32 +530,36 @@ public class PlatformBridgeApis {
|
|||
}
|
||||
@Override
|
||||
protected void writeValue(ByteArrayOutputStream stream, Object value) {
|
||||
if (value instanceof CastDevice) {
|
||||
if (value instanceof AdBreakClipInfo) {
|
||||
stream.write(128);
|
||||
writeValue(stream, ((AdBreakClipInfo) value).toMap());
|
||||
} else
|
||||
if (value instanceof CastDevice) {
|
||||
stream.write(129);
|
||||
writeValue(stream, ((CastDevice) value).toMap());
|
||||
} else
|
||||
if (value instanceof CastMessage) {
|
||||
stream.write(129);
|
||||
stream.write(130);
|
||||
writeValue(stream, ((CastMessage) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaInfo) {
|
||||
stream.write(130);
|
||||
stream.write(131);
|
||||
writeValue(stream, ((MediaInfo) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaLoadRequestData) {
|
||||
stream.write(131);
|
||||
stream.write(132);
|
||||
writeValue(stream, ((MediaLoadRequestData) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaMetadata) {
|
||||
stream.write(132);
|
||||
stream.write(133);
|
||||
writeValue(stream, ((MediaMetadata) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaTrack) {
|
||||
stream.write(133);
|
||||
stream.write(134);
|
||||
writeValue(stream, ((MediaTrack) value).toMap());
|
||||
} else
|
||||
if (value instanceof WebImage) {
|
||||
stream.write(134);
|
||||
stream.write(135);
|
||||
writeValue(stream, ((WebImage) value).toMap());
|
||||
} else
|
||||
{
|
||||
|
|
@ -733,24 +822,27 @@ public class PlatformBridgeApis {
|
|||
protected Object readValueOfType(byte type, ByteBuffer buffer) {
|
||||
switch (type) {
|
||||
case (byte)128:
|
||||
return AdBreakStatus.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return AdBreakClipInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)129:
|
||||
return CastMessage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return AdBreakStatus.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)130:
|
||||
return MediaInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return CastMessage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)131:
|
||||
return MediaMetadata.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return MediaInfo.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)132:
|
||||
return MediaStatus.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return MediaMetadata.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)133:
|
||||
return MediaTrack.fromMap((Map<String, Object>) readValue(buffer));
|
||||
return MediaStatus.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)134:
|
||||
return MediaTrack.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
case (byte)135:
|
||||
return WebImage.fromMap((Map<String, Object>) readValue(buffer));
|
||||
|
||||
default:
|
||||
|
|
@ -760,32 +852,36 @@ public class PlatformBridgeApis {
|
|||
}
|
||||
@Override
|
||||
protected void writeValue(ByteArrayOutputStream stream, Object value) {
|
||||
if (value instanceof AdBreakStatus) {
|
||||
if (value instanceof AdBreakClipInfo) {
|
||||
stream.write(128);
|
||||
writeValue(stream, ((AdBreakClipInfo) value).toMap());
|
||||
} else
|
||||
if (value instanceof AdBreakStatus) {
|
||||
stream.write(129);
|
||||
writeValue(stream, ((AdBreakStatus) value).toMap());
|
||||
} else
|
||||
if (value instanceof CastMessage) {
|
||||
stream.write(129);
|
||||
stream.write(130);
|
||||
writeValue(stream, ((CastMessage) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaInfo) {
|
||||
stream.write(130);
|
||||
stream.write(131);
|
||||
writeValue(stream, ((MediaInfo) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaMetadata) {
|
||||
stream.write(131);
|
||||
stream.write(132);
|
||||
writeValue(stream, ((MediaMetadata) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaStatus) {
|
||||
stream.write(132);
|
||||
stream.write(133);
|
||||
writeValue(stream, ((MediaStatus) value).toMap());
|
||||
} else
|
||||
if (value instanceof MediaTrack) {
|
||||
stream.write(133);
|
||||
stream.write(134);
|
||||
writeValue(stream, ((MediaTrack) value).toMap());
|
||||
} else
|
||||
if (value instanceof WebImage) {
|
||||
stream.write(134);
|
||||
stream.write(135);
|
||||
writeValue(stream, ((WebImage) value).toMap());
|
||||
} else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ fun getFlutterMediaInfo(mediaInfo: MediaInfo?): PlatformBridgeApis.MediaInfo {
|
|||
val flutterMediaMetadata = getFlutterMediaMetadata(mediaInfo?.metadata)
|
||||
val flutterMediaTracks = getFlutterMediaTracks(mediaInfo?.mediaTracks)
|
||||
val flutterStreamType = getFlutterStreamType(mediaInfo?.streamType)
|
||||
val flutterAdBreakClips = getFlutterAdBreakClips(mediaInfo?.adBreakClips)
|
||||
|
||||
return PlatformBridgeApis.MediaInfo().apply {
|
||||
contentId = mediaInfo?.contentId ?: ""
|
||||
|
|
@ -50,6 +51,7 @@ fun getFlutterMediaInfo(mediaInfo: MediaInfo?): PlatformBridgeApis.MediaInfo {
|
|||
mediaTracks = flutterMediaTracks
|
||||
streamDuration = mediaInfo?.streamDuration ?: 0
|
||||
streamType = flutterStreamType
|
||||
adBreakClips = flutterAdBreakClips
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +85,26 @@ fun getFlutterMediaTrack(mediaTrack: MediaTrack?): PlatformBridgeApis.MediaTrack
|
|||
}
|
||||
}
|
||||
|
||||
fun getFlutterAdBreakClips(adBreakClips: List<AdBreakClipInfo>?): List<PlatformBridgeApis.AdBreakClipInfo> {
|
||||
return adBreakClips?.map {
|
||||
getFlutterAdBreakClipInfo(it)
|
||||
} ?: emptyList()
|
||||
}
|
||||
|
||||
fun getFlutterAdBreakClipInfo(adBreakClipInfo: AdBreakClipInfo?): PlatformBridgeApis.AdBreakClipInfo {
|
||||
return PlatformBridgeApis.AdBreakClipInfo().apply {
|
||||
id = adBreakClipInfo?.id
|
||||
title = adBreakClipInfo?.title
|
||||
contentId = adBreakClipInfo?.contentId
|
||||
contentUrl = adBreakClipInfo?.contentUrl
|
||||
clickThroughUrl = adBreakClipInfo?.clickThroughUrl
|
||||
durationMs = adBreakClipInfo?.durationInMs
|
||||
imageUrl = adBreakClipInfo?.imageUrl
|
||||
mimeType = adBreakClipInfo?.mimeType
|
||||
whenSkippableMs = adBreakClipInfo?.whenSkippableInMs
|
||||
}
|
||||
}
|
||||
|
||||
fun getFlutterType(type: Int?): PlatformBridgeApis.TrackType {
|
||||
return when (type) {
|
||||
0 -> PlatformBridgeApis.TrackType.unknown
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ func getFlutterAdBreakStatus(adBreakStatus: GCKAdBreakStatus?) -> AdBreakStatus
|
|||
}
|
||||
|
||||
func getFlutterWhenSkippableMs(whenSkippable: TimeInterval?) -> NSNumber {
|
||||
if (whenSkippable == nil || whenSkippable?.isNaN == true || whenSkippable?.isInfinite == true) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let whenSkippableSecs = whenSkippable ?? 0
|
||||
let whenSkippableMs = Int(whenSkippableSecs * 1000)
|
||||
|
||||
|
|
@ -77,12 +81,13 @@ func getFlutterMediaInfo(mediaInfo: GCKMediaInformation?) -> MediaInfo {
|
|||
result.mediaTracks = getFlutterMediaTracks(mediaTracks: mediaInfo?.mediaTracks)
|
||||
result.streamDuration = getStreamDuration(streamDuration: mediaInfo?.streamDuration)
|
||||
result.streamType = getFlutterStreamType(streamType: mediaInfo?.streamType)
|
||||
result.adBreakClips = getFlutterAdBreakClips(adBreakClips: mediaInfo?.adBreakClips)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func getStreamDuration(streamDuration: TimeInterval?) -> NSNumber {
|
||||
if (streamDuration == nil) {
|
||||
if (streamDuration == nil || streamDuration?.isNaN == true || streamDuration?.isInfinite == true) {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
@ -134,6 +139,35 @@ func getFlutterMediaTrack(mediaTrack: GCKMediaTrack) -> MediaTrack {
|
|||
return result
|
||||
}
|
||||
|
||||
func getFlutterAdBreakClips(adBreakClips: [GCKAdBreakClipInfo]?) -> [AdBreakClipInfo]? {
|
||||
if (adBreakClips == nil) {
|
||||
return nil
|
||||
}
|
||||
|
||||
var result = [AdBreakClipInfo]()
|
||||
adBreakClips?.forEach({ (info: GCKAdBreakClipInfo) in
|
||||
let resultInfo = getFlutterAdBreakClipInfo(adBreakClipInfo: info)
|
||||
result.append(resultInfo)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
func getFlutterAdBreakClipInfo(adBreakClipInfo: GCKAdBreakClipInfo) -> AdBreakClipInfo {
|
||||
let result = AdBreakClipInfo()
|
||||
|
||||
result.id = adBreakClipInfo.adBreakClipID
|
||||
result.title = adBreakClipInfo.title
|
||||
result.contentId = adBreakClipInfo.contentID
|
||||
result.contentUrl = adBreakClipInfo.contentURL?.absoluteString
|
||||
result.clickThroughUrl = adBreakClipInfo.clickThroughURL?.absoluteString
|
||||
result.durationMs = getStreamDuration(streamDuration: adBreakClipInfo.duration)
|
||||
result.imageUrl = adBreakClipInfo.posterURL?.absoluteString
|
||||
result.mimeType = adBreakClipInfo.mimeType
|
||||
result.whenSkippableMs = getFlutterWhenSkippableMs(whenSkippable: adBreakClipInfo.whenSkippable)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func getFlutterTrackType(trackType: GCKMediaTrackType) -> TrackType {
|
||||
switch trackType {
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ typedef NS_ENUM(NSUInteger, PlayerState) {
|
|||
@class MediaTrack;
|
||||
@class MediaStatus;
|
||||
@class AdBreakStatus;
|
||||
@class AdBreakClipInfo;
|
||||
@class CastDevice;
|
||||
@class CastMessage;
|
||||
|
||||
|
|
@ -74,6 +75,7 @@ typedef NS_ENUM(NSUInteger, PlayerState) {
|
|||
@property(nonatomic, strong, nullable) MediaMetadata * mediaMetadata;
|
||||
@property(nonatomic, strong, nullable) NSArray<MediaTrack *> * mediaTracks;
|
||||
@property(nonatomic, strong, nullable) NSNumber * streamDuration;
|
||||
@property(nonatomic, strong, nullable) NSArray<AdBreakClipInfo *> * adBreakClips;
|
||||
@property(nonatomic, copy, nullable) NSString * customDataAsJson;
|
||||
@end
|
||||
|
||||
|
|
@ -108,6 +110,18 @@ typedef NS_ENUM(NSUInteger, PlayerState) {
|
|||
@property(nonatomic, strong, nullable) NSNumber * whenSkippableMs;
|
||||
@end
|
||||
|
||||
@interface AdBreakClipInfo : NSObject
|
||||
@property(nonatomic, copy, nullable) NSString * id;
|
||||
@property(nonatomic, copy, nullable) NSString * title;
|
||||
@property(nonatomic, copy, nullable) NSString * contentId;
|
||||
@property(nonatomic, copy, nullable) NSString * contentUrl;
|
||||
@property(nonatomic, copy, nullable) NSString * clickThroughUrl;
|
||||
@property(nonatomic, strong, nullable) NSNumber * durationMs;
|
||||
@property(nonatomic, copy, nullable) NSString * imageUrl;
|
||||
@property(nonatomic, copy, nullable) NSString * mimeType;
|
||||
@property(nonatomic, strong, nullable) NSNumber * whenSkippableMs;
|
||||
@end
|
||||
|
||||
@interface CastDevice : NSObject
|
||||
@property(nonatomic, copy, nullable) NSString * deviceId;
|
||||
@property(nonatomic, copy, nullable) NSString * friendlyName;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
+ (AdBreakStatus *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface AdBreakClipInfo ()
|
||||
+ (AdBreakClipInfo *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
@interface CastDevice ()
|
||||
+ (CastDevice *)fromMap:(NSDictionary *)dict;
|
||||
- (NSDictionary *)toMap;
|
||||
|
|
@ -105,6 +109,10 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
if ((NSNull *)result.streamDuration == [NSNull null]) {
|
||||
result.streamDuration = nil;
|
||||
}
|
||||
result.adBreakClips = dict[@"adBreakClips"];
|
||||
if ((NSNull *)result.adBreakClips == [NSNull null]) {
|
||||
result.adBreakClips = nil;
|
||||
}
|
||||
result.customDataAsJson = dict[@"customDataAsJson"];
|
||||
if ((NSNull *)result.customDataAsJson == [NSNull null]) {
|
||||
result.customDataAsJson = nil;
|
||||
|
|
@ -112,7 +120,7 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
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];
|
||||
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.adBreakClips ? self.adBreakClips : [NSNull null]), @"adBreakClips", (self.customDataAsJson ? self.customDataAsJson : [NSNull null]), @"customDataAsJson", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
@ -218,6 +226,52 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation AdBreakClipInfo
|
||||
+ (AdBreakClipInfo *)fromMap:(NSDictionary *)dict {
|
||||
AdBreakClipInfo *result = [[AdBreakClipInfo alloc] init];
|
||||
result.id = dict[@"id"];
|
||||
if ((NSNull *)result.id == [NSNull null]) {
|
||||
result.id = nil;
|
||||
}
|
||||
result.title = dict[@"title"];
|
||||
if ((NSNull *)result.title == [NSNull null]) {
|
||||
result.title = nil;
|
||||
}
|
||||
result.contentId = dict[@"contentId"];
|
||||
if ((NSNull *)result.contentId == [NSNull null]) {
|
||||
result.contentId = nil;
|
||||
}
|
||||
result.contentUrl = dict[@"contentUrl"];
|
||||
if ((NSNull *)result.contentUrl == [NSNull null]) {
|
||||
result.contentUrl = nil;
|
||||
}
|
||||
result.clickThroughUrl = dict[@"clickThroughUrl"];
|
||||
if ((NSNull *)result.clickThroughUrl == [NSNull null]) {
|
||||
result.clickThroughUrl = nil;
|
||||
}
|
||||
result.durationMs = dict[@"durationMs"];
|
||||
if ((NSNull *)result.durationMs == [NSNull null]) {
|
||||
result.durationMs = nil;
|
||||
}
|
||||
result.imageUrl = dict[@"imageUrl"];
|
||||
if ((NSNull *)result.imageUrl == [NSNull null]) {
|
||||
result.imageUrl = nil;
|
||||
}
|
||||
result.mimeType = dict[@"mimeType"];
|
||||
if ((NSNull *)result.mimeType == [NSNull null]) {
|
||||
result.mimeType = nil;
|
||||
}
|
||||
result.whenSkippableMs = dict[@"whenSkippableMs"];
|
||||
if ((NSNull *)result.whenSkippableMs == [NSNull null]) {
|
||||
result.whenSkippableMs = nil;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:(self.id ? self.id : [NSNull null]), @"id", (self.title ? self.title : [NSNull null]), @"title", (self.contentId ? self.contentId : [NSNull null]), @"contentId", (self.contentUrl ? self.contentUrl : [NSNull null]), @"contentUrl", (self.clickThroughUrl ? self.clickThroughUrl : [NSNull null]), @"clickThroughUrl", (self.durationMs ? self.durationMs : [NSNull null]), @"durationMs", (self.imageUrl ? self.imageUrl : [NSNull null]), @"imageUrl", (self.mimeType ? self.mimeType : [NSNull null]), @"mimeType", (self.whenSkippableMs ? self.whenSkippableMs : [NSNull null]), @"whenSkippableMs", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation CastDevice
|
||||
+ (CastDevice *)fromMap:(NSDictionary *)dict {
|
||||
CastDevice *result = [[CastDevice alloc] init];
|
||||
|
|
@ -265,24 +319,27 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
{
|
||||
switch (type) {
|
||||
case 128:
|
||||
return [CastDevice fromMap:[self readValue]];
|
||||
return [AdBreakClipInfo fromMap:[self readValue]];
|
||||
|
||||
case 129:
|
||||
return [CastMessage fromMap:[self readValue]];
|
||||
return [CastDevice fromMap:[self readValue]];
|
||||
|
||||
case 130:
|
||||
return [MediaInfo fromMap:[self readValue]];
|
||||
return [CastMessage fromMap:[self readValue]];
|
||||
|
||||
case 131:
|
||||
return [MediaLoadRequestData fromMap:[self readValue]];
|
||||
return [MediaInfo fromMap:[self readValue]];
|
||||
|
||||
case 132:
|
||||
return [MediaMetadata fromMap:[self readValue]];
|
||||
return [MediaLoadRequestData fromMap:[self readValue]];
|
||||
|
||||
case 133:
|
||||
return [MediaTrack fromMap:[self readValue]];
|
||||
return [MediaMetadata fromMap:[self readValue]];
|
||||
|
||||
case 134:
|
||||
return [MediaTrack fromMap:[self readValue]];
|
||||
|
||||
case 135:
|
||||
return [WebImage fromMap:[self readValue]];
|
||||
|
||||
default:
|
||||
|
|
@ -297,34 +354,38 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
@implementation CastHostApiCodecWriter
|
||||
- (void)writeValue:(id)value
|
||||
{
|
||||
if ([value isKindOfClass:[CastDevice class]]) {
|
||||
if ([value isKindOfClass:[AdBreakClipInfo class]]) {
|
||||
[self writeByte:128];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[CastMessage class]]) {
|
||||
if ([value isKindOfClass:[CastDevice class]]) {
|
||||
[self writeByte:129];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaInfo class]]) {
|
||||
if ([value isKindOfClass:[CastMessage class]]) {
|
||||
[self writeByte:130];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaLoadRequestData class]]) {
|
||||
if ([value isKindOfClass:[MediaInfo class]]) {
|
||||
[self writeByte:131];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaMetadata class]]) {
|
||||
if ([value isKindOfClass:[MediaLoadRequestData class]]) {
|
||||
[self writeByte:132];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaTrack class]]) {
|
||||
if ([value isKindOfClass:[MediaMetadata class]]) {
|
||||
[self writeByte:133];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[WebImage class]]) {
|
||||
if ([value isKindOfClass:[MediaTrack class]]) {
|
||||
[self writeByte:134];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[WebImage class]]) {
|
||||
[self writeByte:135];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
{
|
||||
[super writeValue:value];
|
||||
}
|
||||
|
|
@ -566,24 +627,27 @@ void CastHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<CastH
|
|||
{
|
||||
switch (type) {
|
||||
case 128:
|
||||
return [AdBreakStatus fromMap:[self readValue]];
|
||||
return [AdBreakClipInfo fromMap:[self readValue]];
|
||||
|
||||
case 129:
|
||||
return [CastMessage fromMap:[self readValue]];
|
||||
return [AdBreakStatus fromMap:[self readValue]];
|
||||
|
||||
case 130:
|
||||
return [MediaInfo fromMap:[self readValue]];
|
||||
return [CastMessage fromMap:[self readValue]];
|
||||
|
||||
case 131:
|
||||
return [MediaMetadata fromMap:[self readValue]];
|
||||
return [MediaInfo fromMap:[self readValue]];
|
||||
|
||||
case 132:
|
||||
return [MediaStatus fromMap:[self readValue]];
|
||||
return [MediaMetadata fromMap:[self readValue]];
|
||||
|
||||
case 133:
|
||||
return [MediaTrack fromMap:[self readValue]];
|
||||
return [MediaStatus fromMap:[self readValue]];
|
||||
|
||||
case 134:
|
||||
return [MediaTrack fromMap:[self readValue]];
|
||||
|
||||
case 135:
|
||||
return [WebImage fromMap:[self readValue]];
|
||||
|
||||
default:
|
||||
|
|
@ -598,34 +662,38 @@ void CastHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<CastH
|
|||
@implementation CastFlutterApiCodecWriter
|
||||
- (void)writeValue:(id)value
|
||||
{
|
||||
if ([value isKindOfClass:[AdBreakStatus class]]) {
|
||||
if ([value isKindOfClass:[AdBreakClipInfo class]]) {
|
||||
[self writeByte:128];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[CastMessage class]]) {
|
||||
if ([value isKindOfClass:[AdBreakStatus class]]) {
|
||||
[self writeByte:129];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaInfo class]]) {
|
||||
if ([value isKindOfClass:[CastMessage class]]) {
|
||||
[self writeByte:130];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaMetadata class]]) {
|
||||
if ([value isKindOfClass:[MediaInfo class]]) {
|
||||
[self writeByte:131];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaStatus class]]) {
|
||||
if ([value isKindOfClass:[MediaMetadata class]]) {
|
||||
[self writeByte:132];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[MediaTrack class]]) {
|
||||
if ([value isKindOfClass:[MediaStatus class]]) {
|
||||
[self writeByte:133];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[WebImage class]]) {
|
||||
if ([value isKindOfClass:[MediaTrack class]]) {
|
||||
[self writeByte:134];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
if ([value isKindOfClass:[WebImage class]]) {
|
||||
[self writeByte:135];
|
||||
[self writeValue:[value toMap]];
|
||||
} else
|
||||
{
|
||||
[super writeValue:value];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class MediaInfo {
|
|||
MediaMetadata? mediaMetadata;
|
||||
List<MediaTrack?>? mediaTracks;
|
||||
int? streamDuration;
|
||||
List<AdBreakClipInfo?>? adBreakClips;
|
||||
String? customDataAsJson;
|
||||
|
||||
Object encode() {
|
||||
|
|
@ -92,6 +93,7 @@ class MediaInfo {
|
|||
pigeonMap['mediaMetadata'] = mediaMetadata == null ? null : mediaMetadata!.encode();
|
||||
pigeonMap['mediaTracks'] = mediaTracks;
|
||||
pigeonMap['streamDuration'] = streamDuration;
|
||||
pigeonMap['adBreakClips'] = adBreakClips;
|
||||
pigeonMap['customDataAsJson'] = customDataAsJson;
|
||||
return pigeonMap;
|
||||
}
|
||||
|
|
@ -109,6 +111,7 @@ class MediaInfo {
|
|||
: null
|
||||
..mediaTracks = (pigeonMap['mediaTracks'] as List<Object?>?)?.cast<MediaTrack?>()
|
||||
..streamDuration = pigeonMap['streamDuration'] as int?
|
||||
..adBreakClips = (pigeonMap['adBreakClips'] as List<Object?>?)?.cast<AdBreakClipInfo?>()
|
||||
..customDataAsJson = pigeonMap['customDataAsJson'] as String?;
|
||||
}
|
||||
}
|
||||
|
|
@ -238,6 +241,46 @@ class AdBreakStatus {
|
|||
}
|
||||
}
|
||||
|
||||
class AdBreakClipInfo {
|
||||
String? id;
|
||||
String? title;
|
||||
String? contentId;
|
||||
String? contentUrl;
|
||||
String? clickThroughUrl;
|
||||
int? durationMs;
|
||||
String? imageUrl;
|
||||
String? mimeType;
|
||||
int? whenSkippableMs;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
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;
|
||||
}
|
||||
|
||||
static AdBreakClipInfo decode(Object message) {
|
||||
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
|
||||
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?;
|
||||
}
|
||||
}
|
||||
|
||||
class CastDevice {
|
||||
String? deviceId;
|
||||
String? friendlyName;
|
||||
|
|
@ -283,34 +326,38 @@ class _CastHostApiCodec extends StandardMessageCodec {
|
|||
const _CastHostApiCodec();
|
||||
@override
|
||||
void writeValue(WriteBuffer buffer, Object? value) {
|
||||
if (value is CastDevice) {
|
||||
if (value is AdBreakClipInfo) {
|
||||
buffer.putUint8(128);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is CastMessage) {
|
||||
if (value is CastDevice) {
|
||||
buffer.putUint8(129);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaInfo) {
|
||||
if (value is CastMessage) {
|
||||
buffer.putUint8(130);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaLoadRequestData) {
|
||||
if (value is MediaInfo) {
|
||||
buffer.putUint8(131);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaMetadata) {
|
||||
if (value is MediaLoadRequestData) {
|
||||
buffer.putUint8(132);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaTrack) {
|
||||
if (value is MediaMetadata) {
|
||||
buffer.putUint8(133);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is WebImage) {
|
||||
if (value is MediaTrack) {
|
||||
buffer.putUint8(134);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is WebImage) {
|
||||
buffer.putUint8(135);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
{
|
||||
super.writeValue(buffer, value);
|
||||
}
|
||||
|
|
@ -319,24 +366,27 @@ class _CastHostApiCodec extends StandardMessageCodec {
|
|||
Object? readValueOfType(int type, ReadBuffer buffer) {
|
||||
switch (type) {
|
||||
case 128:
|
||||
return CastDevice.decode(readValue(buffer)!);
|
||||
return AdBreakClipInfo.decode(readValue(buffer)!);
|
||||
|
||||
case 129:
|
||||
return CastMessage.decode(readValue(buffer)!);
|
||||
return CastDevice.decode(readValue(buffer)!);
|
||||
|
||||
case 130:
|
||||
return MediaInfo.decode(readValue(buffer)!);
|
||||
return CastMessage.decode(readValue(buffer)!);
|
||||
|
||||
case 131:
|
||||
return MediaLoadRequestData.decode(readValue(buffer)!);
|
||||
return MediaInfo.decode(readValue(buffer)!);
|
||||
|
||||
case 132:
|
||||
return MediaMetadata.decode(readValue(buffer)!);
|
||||
return MediaLoadRequestData.decode(readValue(buffer)!);
|
||||
|
||||
case 133:
|
||||
return MediaTrack.decode(readValue(buffer)!);
|
||||
return MediaMetadata.decode(readValue(buffer)!);
|
||||
|
||||
case 134:
|
||||
return MediaTrack.decode(readValue(buffer)!);
|
||||
|
||||
case 135:
|
||||
return WebImage.decode(readValue(buffer)!);
|
||||
|
||||
default:
|
||||
|
|
@ -614,34 +664,38 @@ class _CastFlutterApiCodec extends StandardMessageCodec {
|
|||
const _CastFlutterApiCodec();
|
||||
@override
|
||||
void writeValue(WriteBuffer buffer, Object? value) {
|
||||
if (value is AdBreakStatus) {
|
||||
if (value is AdBreakClipInfo) {
|
||||
buffer.putUint8(128);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is CastMessage) {
|
||||
if (value is AdBreakStatus) {
|
||||
buffer.putUint8(129);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaInfo) {
|
||||
if (value is CastMessage) {
|
||||
buffer.putUint8(130);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaMetadata) {
|
||||
if (value is MediaInfo) {
|
||||
buffer.putUint8(131);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaStatus) {
|
||||
if (value is MediaMetadata) {
|
||||
buffer.putUint8(132);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is MediaTrack) {
|
||||
if (value is MediaStatus) {
|
||||
buffer.putUint8(133);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is WebImage) {
|
||||
if (value is MediaTrack) {
|
||||
buffer.putUint8(134);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
if (value is WebImage) {
|
||||
buffer.putUint8(135);
|
||||
writeValue(buffer, value.encode());
|
||||
} else
|
||||
{
|
||||
super.writeValue(buffer, value);
|
||||
}
|
||||
|
|
@ -650,24 +704,27 @@ class _CastFlutterApiCodec extends StandardMessageCodec {
|
|||
Object? readValueOfType(int type, ReadBuffer buffer) {
|
||||
switch (type) {
|
||||
case 128:
|
||||
return AdBreakStatus.decode(readValue(buffer)!);
|
||||
return AdBreakClipInfo.decode(readValue(buffer)!);
|
||||
|
||||
case 129:
|
||||
return CastMessage.decode(readValue(buffer)!);
|
||||
return AdBreakStatus.decode(readValue(buffer)!);
|
||||
|
||||
case 130:
|
||||
return MediaInfo.decode(readValue(buffer)!);
|
||||
return CastMessage.decode(readValue(buffer)!);
|
||||
|
||||
case 131:
|
||||
return MediaMetadata.decode(readValue(buffer)!);
|
||||
return MediaInfo.decode(readValue(buffer)!);
|
||||
|
||||
case 132:
|
||||
return MediaStatus.decode(readValue(buffer)!);
|
||||
return MediaMetadata.decode(readValue(buffer)!);
|
||||
|
||||
case 133:
|
||||
return MediaTrack.decode(readValue(buffer)!);
|
||||
return MediaStatus.decode(readValue(buffer)!);
|
||||
|
||||
case 134:
|
||||
return MediaTrack.decode(readValue(buffer)!);
|
||||
|
||||
case 135:
|
||||
return WebImage.decode(readValue(buffer)!);
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ class MediaInfo {
|
|||
List<MediaTrack?>? mediaTracks;
|
||||
int? streamDuration;
|
||||
|
||||
List<AdBreakClipInfo?>? adBreakClips;
|
||||
|
||||
/// String containing a json object
|
||||
String? customDataAsJson;
|
||||
}
|
||||
|
|
@ -239,6 +241,18 @@ class AdBreakStatus {
|
|||
int? whenSkippableMs;
|
||||
}
|
||||
|
||||
class AdBreakClipInfo {
|
||||
String? id;
|
||||
String? title;
|
||||
String? contentId;
|
||||
String? contentUrl;
|
||||
String? clickThroughUrl;
|
||||
int? durationMs;
|
||||
String? imageUrl;
|
||||
String? mimeType;
|
||||
int? whenSkippableMs;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
class CastDevice {
|
||||
|
|
|
|||
Loading…
Reference in a new issue