RemoteMediaClient: Removed Map
- because of https://github.com/flutter/flutter/issues/93525
This commit is contained in:
parent
264d7ab42d
commit
81dd86692b
7 changed files with 42 additions and 151 deletions
|
|
@ -46,42 +46,6 @@ public class PlatformBridgeApis {
|
|||
}
|
||||
}
|
||||
|
||||
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),
|
||||
|
|
@ -209,10 +173,6 @@ public class PlatformBridgeApis {
|
|||
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; }
|
||||
|
|
@ -220,7 +180,6 @@ public class PlatformBridgeApis {
|
|||
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;
|
||||
}
|
||||
|
|
@ -228,8 +187,6 @@ public class PlatformBridgeApis {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ fun getMediaMetadata(mediaMetadata: PlatformBridgeApis.MediaMetadata) : MediaMet
|
|||
val mediaType = getMediaType(mediaMetadata.mediaType)
|
||||
val result = MediaMetadata(mediaType)
|
||||
|
||||
mediaMetadata.strings.forEach {
|
||||
val key = getMediaMetadataKey(it.key)
|
||||
result.putString(key, it.value)
|
||||
}
|
||||
// mediaMetadata.strings.forEach {
|
||||
// val key = getMediaMetadataKey(it.key)
|
||||
// result.putString(key, it.value)
|
||||
// }
|
||||
|
||||
mediaMetadata.webImages.forEach {
|
||||
val uri = Uri.parse(it.url)
|
||||
|
|
@ -76,38 +76,38 @@ fun getMediaType(mediaType: PlatformBridgeApis.MediaType) : Int {
|
|||
}
|
||||
}
|
||||
|
||||
fun getMediaMetadataKey(mediaMetadataKey: PlatformBridgeApis.MediaMetadataKey) : String {
|
||||
return when (mediaMetadataKey) {
|
||||
PlatformBridgeApis.MediaMetadataKey.albumArtist -> "com.google.android.gms.cast.metadata.ALBUM_ARTIST"
|
||||
PlatformBridgeApis.MediaMetadataKey.albumTitle -> "com.google.android.gms.cast.metadata.ALBUM_TITLE"
|
||||
PlatformBridgeApis.MediaMetadataKey.artist -> "com.google.android.gms.cast.metadata.ARTIST"
|
||||
PlatformBridgeApis.MediaMetadataKey.bookTitle -> "com.google.android.gms.cast.metadata.BOOK_TITLE"
|
||||
PlatformBridgeApis.MediaMetadataKey.broadcastDate -> "com.google.android.gms.cast.metadata.BROADCAST_DATE"
|
||||
PlatformBridgeApis.MediaMetadataKey.chapterNumber -> "com.google.android.gms.cast.metadata.CHAPTER_NUMBER"
|
||||
PlatformBridgeApis.MediaMetadataKey.chapterTitle -> "com.google.android.gms.cast.metadata.CHAPTER_TITLE"
|
||||
PlatformBridgeApis.MediaMetadataKey.composer -> "com.google.android.gms.cast.metadata.COMPOSER"
|
||||
PlatformBridgeApis.MediaMetadataKey.creationDate -> "com.google.android.gms.cast.metadata.CREATION_DATE"
|
||||
PlatformBridgeApis.MediaMetadataKey.discNumber -> "com.google.android.gms.cast.metadata.DISC_NUMBER"
|
||||
PlatformBridgeApis.MediaMetadataKey.episodeNumber -> "com.google.android.gms.cast.metadata.EPISODE_NUMBER"
|
||||
PlatformBridgeApis.MediaMetadataKey.height -> "com.google.android.gms.cast.metadata.HEIGHT"
|
||||
PlatformBridgeApis.MediaMetadataKey.locationLatitude -> "com.google.android.gms.cast.metadata.LOCATION_LATITUDE"
|
||||
PlatformBridgeApis.MediaMetadataKey.locationLongitude -> "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE"
|
||||
PlatformBridgeApis.MediaMetadataKey.locationName -> "com.google.android.gms.cast.metadata.LOCATION_NAME"
|
||||
PlatformBridgeApis.MediaMetadataKey.queueItemId -> "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID"
|
||||
PlatformBridgeApis.MediaMetadataKey.releaseDate -> "com.google.android.gms.cast.metadata.RELEASE_DATE"
|
||||
PlatformBridgeApis.MediaMetadataKey.seasonNumber -> "com.google.android.gms.cast.metadata.SEASON_NUMBER"
|
||||
PlatformBridgeApis.MediaMetadataKey.sectionDuration -> "com.google.android.gms.cast.metadata.SECTION_DURATION"
|
||||
PlatformBridgeApis.MediaMetadataKey.sectionStartAbsoluteTime -> "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME"
|
||||
PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInContainer -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER"
|
||||
PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInMedia -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA"
|
||||
PlatformBridgeApis.MediaMetadataKey.seriesTitle -> "com.google.android.gms.cast.metadata.SERIES_TITLE"
|
||||
PlatformBridgeApis.MediaMetadataKey.studio -> "com.google.android.gms.cast.metadata.STUDIO"
|
||||
PlatformBridgeApis.MediaMetadataKey.subtitle -> "com.google.android.gms.cast.metadata.SUBTITLE"
|
||||
PlatformBridgeApis.MediaMetadataKey.title -> "com.google.android.gms.cast.metadata.TITLE"
|
||||
PlatformBridgeApis.MediaMetadataKey.trackNumber -> "com.google.android.gms.cast.metadata.TRACK_NUMBER"
|
||||
PlatformBridgeApis.MediaMetadataKey.width -> "com.google.android.gms.cast.metadata.WIDTH"
|
||||
}
|
||||
}
|
||||
//fun getMediaMetadataKey(mediaMetadataKey: PlatformBridgeApis.MediaMetadataKey) : String {
|
||||
// return when (mediaMetadataKey) {
|
||||
// PlatformBridgeApis.MediaMetadataKey.albumArtist -> "com.google.android.gms.cast.metadata.ALBUM_ARTIST"
|
||||
// PlatformBridgeApis.MediaMetadataKey.albumTitle -> "com.google.android.gms.cast.metadata.ALBUM_TITLE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.artist -> "com.google.android.gms.cast.metadata.ARTIST"
|
||||
// PlatformBridgeApis.MediaMetadataKey.bookTitle -> "com.google.android.gms.cast.metadata.BOOK_TITLE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.broadcastDate -> "com.google.android.gms.cast.metadata.BROADCAST_DATE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.chapterNumber -> "com.google.android.gms.cast.metadata.CHAPTER_NUMBER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.chapterTitle -> "com.google.android.gms.cast.metadata.CHAPTER_TITLE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.composer -> "com.google.android.gms.cast.metadata.COMPOSER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.creationDate -> "com.google.android.gms.cast.metadata.CREATION_DATE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.discNumber -> "com.google.android.gms.cast.metadata.DISC_NUMBER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.episodeNumber -> "com.google.android.gms.cast.metadata.EPISODE_NUMBER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.height -> "com.google.android.gms.cast.metadata.HEIGHT"
|
||||
// PlatformBridgeApis.MediaMetadataKey.locationLatitude -> "com.google.android.gms.cast.metadata.LOCATION_LATITUDE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.locationLongitude -> "com.google.android.gms.cast.metadata.LOCATION_LONGITUDE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.locationName -> "com.google.android.gms.cast.metadata.LOCATION_NAME"
|
||||
// PlatformBridgeApis.MediaMetadataKey.queueItemId -> "com.google.android.gms.cast.metadata.QUEUE_ITEM_ID"
|
||||
// PlatformBridgeApis.MediaMetadataKey.releaseDate -> "com.google.android.gms.cast.metadata.RELEASE_DATE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.seasonNumber -> "com.google.android.gms.cast.metadata.SEASON_NUMBER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.sectionDuration -> "com.google.android.gms.cast.metadata.SECTION_DURATION"
|
||||
// PlatformBridgeApis.MediaMetadataKey.sectionStartAbsoluteTime -> "com.google.android.gms.cast.metadata.SECTION_START_ABSOLUTE_TIME"
|
||||
// PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInContainer -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_CONTAINER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.sectionStartTimeInMedia -> "com.google.android.gms.cast.metadata.SECTION_START_TIME_IN_MEDIA"
|
||||
// PlatformBridgeApis.MediaMetadataKey.seriesTitle -> "com.google.android.gms.cast.metadata.SERIES_TITLE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.studio -> "com.google.android.gms.cast.metadata.STUDIO"
|
||||
// PlatformBridgeApis.MediaMetadataKey.subtitle -> "com.google.android.gms.cast.metadata.SUBTITLE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.title -> "com.google.android.gms.cast.metadata.TITLE"
|
||||
// PlatformBridgeApis.MediaMetadataKey.trackNumber -> "com.google.android.gms.cast.metadata.TRACK_NUMBER"
|
||||
// PlatformBridgeApis.MediaMetadataKey.width -> "com.google.android.gms.cast.metadata.WIDTH"
|
||||
// }
|
||||
//}
|
||||
|
||||
fun getMediaTrack(mediaTrack: PlatformBridgeApis.MediaTrack) : MediaTrack {
|
||||
val trackType = getTrackType(mediaTrack.trackType)
|
||||
|
|
|
|||
|
|
@ -25,37 +25,6 @@ typedef NS_ENUM(NSUInteger, MediaType) {
|
|||
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,
|
||||
|
|
@ -98,7 +67,6 @@ typedef NS_ENUM(NSUInteger, TrackSubtype) {
|
|||
|
||||
@interface MediaMetadata : NSObject
|
||||
@property(nonatomic, assign) MediaType mediaType;
|
||||
@property(nonatomic, strong, nullable) NSDictionary<MediaMetadataKey *, NSString *> * strings;
|
||||
@property(nonatomic, strong, nullable) NSArray<WebImage *> * webImages;
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -108,10 +108,6 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
+ (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;
|
||||
|
|
@ -119,7 +115,7 @@ static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error)
|
|||
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];
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:@(self.mediaType), @"mediaType", (self.webImages ? self.webImages : [NSNull null]), @"webImages", nil];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,10 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio
|
|||
castContext.presentCastDialog()
|
||||
}
|
||||
|
||||
public func loadMediaLoadRequestDataRequest(_ request: MediaLoadRequestData, error: AutoreleasingUnsafeMutablePointer<FlutterError?>) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
// MARK: - GCKSessionManagerListener
|
||||
|
||||
// onSessionSuspended
|
||||
|
|
|
|||
|
|
@ -25,37 +25,6 @@ enum MediaType {
|
|||
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,
|
||||
|
|
@ -137,13 +106,11 @@ class MediaInfo {
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -154,7 +121,6 @@ class 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?>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ enum StreamType {
|
|||
/// Docs here: https://developers.google.com/android/reference/com/google/android/gms/cast/MediaMetadata
|
||||
class MediaMetadata {
|
||||
MediaType? mediaType;
|
||||
Map<MediaMetadataKey?, String?>? strings;
|
||||
// Map<MediaMetadataKey?, String?>? strings; // Can't uncomment this because of https://github.com/flutter/flutter/issues/93525
|
||||
List<WebImage?>? webImages;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue