react-native-video/RCTVideoManager.m

68 lines
1.6 KiB
Mathematica
Raw Normal View History

2015-03-30 23:07:55 -06:00
#import "RCTVideoManager.h"
#import "RCTVideo.h"
#import "RCTBridge.h"
#import <AVFoundation/AVFoundation.h>
2015-03-30 23:07:55 -06:00
@implementation RCTVideoManager
2015-04-09 13:29:11 -06:00
RCT_EXPORT_MODULE();
2015-03-30 23:07:55 -06:00
@synthesize bridge = _bridge;
- (UIView *)view
{
return [[RCTVideo alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
}
/* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */
- (NSDictionary *)customDirectEventTypes
{
return @{
2015-04-08 02:58:00 -06:00
RNVideoEventLoading: @{
2015-07-15 09:13:24 -06:00
@"registrationName": @"onVideoLoadStart"
},
2015-04-08 02:58:00 -06:00
RNVideoEventLoaded: @{
2015-07-15 09:13:24 -06:00
@"registrationName": @"onVideoLoad"
},
2015-04-08 02:58:00 -06:00
RNVideoEventLoadingError: @{
2015-07-15 09:13:24 -06:00
@"registrationName": @"onVideoError"
},
2015-04-08 02:58:00 -06:00
RNVideoEventProgress: @{
2015-07-15 09:13:24 -06:00
@"registrationName": @"onVideoProgress"
},
2015-04-08 16:15:57 -06:00
RNVideoEventSeek: @{
2015-07-15 09:13:24 -06:00
@"registrationName": @"onVideoSeek"
2015-04-10 20:56:51 -06:00
},
RNVideoEventEnd: @{
2015-07-15 09:13:24 -06:00
@"registrationName": @"onVideoEnd"
2015-04-08 16:15:57 -06:00
}
};
2015-03-30 23:07:55 -06:00
}
2015-07-10 17:03:17 -06:00
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
2015-03-31 00:29:15 -06:00
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
RCT_EXPORT_VIEW_PROPERTY(volume, float);
RCT_EXPORT_VIEW_PROPERTY(rate, float);
RCT_EXPORT_VIEW_PROPERTY(seek, float);
2015-03-30 23:07:55 -06:00
- (NSDictionary *)constantsToExport
{
return @{
@"ScaleNone": AVLayerVideoGravityResizeAspect,
@"ScaleToFill": AVLayerVideoGravityResize,
@"ScaleAspectFit": AVLayerVideoGravityResizeAspect,
@"ScaleAspectFill": AVLayerVideoGravityResizeAspectFill
};
2015-03-30 23:07:55 -06:00
}
@end