RemoteMediaClient create listener pigeons
This commit is contained in:
parent
2125ebf893
commit
5fee6f834f
5 changed files with 234 additions and 0 deletions
|
|
@ -559,6 +559,55 @@ public class PlatformBridgeApis {
|
||||||
callback.reply(null);
|
callback.reply(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public void onStatusUpdated(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onStatusUpdated", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onMetadataUpdated(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onQueueStatusUpdated(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onPreloadStatusUpdated(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onSendingRemoteMediaRequest(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onAdBreakStatusUpdated(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void onMediaError(Reply<Void> callback) {
|
||||||
|
BasicMessageChannel<Object> channel =
|
||||||
|
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.CastFlutterApi.onMediaError", getCodec());
|
||||||
|
channel.send(null, channelReply -> {
|
||||||
|
callback.reply(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private static Map<String, Object> wrapError(Throwable exception) {
|
private static Map<String, Object> wrapError(Throwable exception) {
|
||||||
Map<String, Object> errorMap = new HashMap<>();
|
Map<String, Object> errorMap = new HashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -116,5 +116,12 @@ NSObject<FlutterMessageCodec> *CastFlutterApiGetCodec(void);
|
||||||
- (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
- (void)onSessionResumedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
- (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
- (void)onSessionResumeFailedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
- (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
- (void)onSessionSuspendedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onMetadataUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onQueueStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onPreloadStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onSendingRemoteMediaRequestWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onAdBreakStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
|
- (void)onMediaErrorWithCompletion:(void(^)(NSError *_Nullable))completion;
|
||||||
@end
|
@end
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
||||||
|
|
@ -514,4 +514,74 @@ NSObject<FlutterMessageCodec> *CastFlutterApiGetCodec() {
|
||||||
completion(nil);
|
completion(nil);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
- (void)onStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onStatusUpdated"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onMetadataUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onQueueStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onPreloadStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onSendingRemoteMediaRequestWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onAdBreakStatusUpdatedWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
- (void)onMediaErrorWithCompletion:(void(^)(NSError *_Nullable))completion {
|
||||||
|
FlutterBasicMessageChannel *channel =
|
||||||
|
[FlutterBasicMessageChannel
|
||||||
|
messageChannelWithName:@"dev.flutter.pigeon.CastFlutterApi.onMediaError"
|
||||||
|
binaryMessenger:self.binaryMessenger
|
||||||
|
codec:CastFlutterApiGetCodec()];
|
||||||
|
[channel sendMessage:nil reply:^(id reply) {
|
||||||
|
completion(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -374,6 +374,13 @@ abstract class CastFlutterApi {
|
||||||
void onSessionResumed();
|
void onSessionResumed();
|
||||||
void onSessionResumeFailed();
|
void onSessionResumeFailed();
|
||||||
void onSessionSuspended();
|
void onSessionSuspended();
|
||||||
|
void onStatusUpdated();
|
||||||
|
void onMetadataUpdated();
|
||||||
|
void onQueueStatusUpdated();
|
||||||
|
void onPreloadStatusUpdated();
|
||||||
|
void onSendingRemoteMediaRequest();
|
||||||
|
void onAdBreakStatusUpdated();
|
||||||
|
void onMediaError();
|
||||||
static void setup(CastFlutterApi? api) {
|
static void setup(CastFlutterApi? api) {
|
||||||
{
|
{
|
||||||
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
|
@ -537,5 +544,96 @@ abstract class CastFlutterApi {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onStatusUpdated', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onStatusUpdated();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onMetadataUpdated', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onMetadataUpdated();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onQueueStatusUpdated', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onQueueStatusUpdated();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onPreloadStatusUpdated', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onPreloadStatusUpdated();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onSendingRemoteMediaRequest', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onSendingRemoteMediaRequest();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onAdBreakStatusUpdated', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onAdBreakStatusUpdated();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
|
'dev.flutter.pigeon.CastFlutterApi.onMediaError', codec);
|
||||||
|
if (api == null) {
|
||||||
|
channel.setMessageHandler(null);
|
||||||
|
} else {
|
||||||
|
channel.setMessageHandler((Object? message) async {
|
||||||
|
// ignore message
|
||||||
|
api.onMediaError();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,4 +241,14 @@ abstract class CastFlutterApi {
|
||||||
void onSessionResumeFailed();
|
void onSessionResumeFailed();
|
||||||
void onSessionSuspended();
|
void onSessionSuspended();
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
//region RemoteMediaClient callbacks
|
||||||
|
void onStatusUpdated();
|
||||||
|
void onMetadataUpdated();
|
||||||
|
void onQueueStatusUpdated();
|
||||||
|
void onPreloadStatusUpdated();
|
||||||
|
void onSendingRemoteMediaRequest();
|
||||||
|
void onAdBreakStatusUpdated();
|
||||||
|
void onMediaError();
|
||||||
|
//endregion
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue