2019-11-28 06:55:32 +00:00
|
|
|
#import "JustAudioPlugin.h"
|
2019-11-30 15:28:17 +00:00
|
|
|
#import "AudioPlayer.h"
|
|
|
|
#import "AudioPlayer.h"
|
|
|
|
|
|
|
|
@implementation JustAudioPlugin {
|
2019-12-25 13:44:08 +00:00
|
|
|
NSObject<FlutterPluginRegistrar>* _registrar;
|
2019-11-30 15:28:17 +00:00
|
|
|
}
|
2019-11-25 14:50:21 +00:00
|
|
|
|
|
|
|
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
2019-12-25 13:44:08 +00:00
|
|
|
FlutterMethodChannel* channel = [FlutterMethodChannel
|
|
|
|
methodChannelWithName:@"com.ryanheise.just_audio.methods"
|
|
|
|
binaryMessenger:[registrar messenger]];
|
|
|
|
JustAudioPlugin* instance = [[JustAudioPlugin alloc] initWithRegistrar:registrar];
|
|
|
|
[registrar addMethodCallDelegate:instance channel:channel];
|
2019-11-25 14:50:21 +00:00
|
|
|
}
|
|
|
|
|
2019-11-30 15:28:17 +00:00
|
|
|
- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
|
2019-12-25 13:44:08 +00:00
|
|
|
self = [super init];
|
|
|
|
NSAssert(self, @"super init cannot be nil");
|
|
|
|
_registrar = registrar;
|
|
|
|
return self;
|
2019-11-30 15:28:17 +00:00
|
|
|
}
|
|
|
|
|
2019-11-25 14:50:21 +00:00
|
|
|
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
|
2019-12-25 13:44:08 +00:00
|
|
|
if ([@"init" isEqualToString:call.method]) {
|
|
|
|
NSArray* args = (NSArray*)call.arguments;
|
|
|
|
NSString* playerId = args[0];
|
|
|
|
AudioPlayer* player = [[AudioPlayer alloc] initWithRegistrar:_registrar playerId:playerId];
|
|
|
|
result(nil);
|
|
|
|
} else {
|
|
|
|
result(FlutterMethodNotImplemented);
|
|
|
|
}
|
2019-11-25 14:50:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|