2015-03-30 23:07:55 -06:00
|
|
|
#import "RCTVideoManager.h"
|
|
|
|
#import "RCTVideo.h"
|
|
|
|
#import "RCTBridge.h"
|
2015-04-04 18:55:37 -06:00
|
|
|
#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
|
|
|
|
{
|
2015-04-06 13:17:32 -06:00
|
|
|
return [[RCTVideo alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
|
|
|
}
|
|
|
|
|
2015-04-06 14:05:05 -06:00
|
|
|
/* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */
|
2015-04-06 13:17:32 -06:00
|
|
|
|
|
|
|
- (NSDictionary *)customDirectEventTypes
|
|
|
|
{
|
|
|
|
return @{
|
2015-04-08 02:58:00 -06:00
|
|
|
RNVideoEventLoading: @{
|
2015-04-08 00:49:14 -06:00
|
|
|
@"registrationName": @"onLoadStart"
|
|
|
|
},
|
2015-04-08 02:58:00 -06:00
|
|
|
RNVideoEventLoaded: @{
|
2015-04-06 13:17:32 -06:00
|
|
|
@"registrationName": @"onLoad"
|
|
|
|
},
|
2015-04-08 02:58:00 -06:00
|
|
|
RNVideoEventLoadingError: @{
|
2015-04-08 00:49:14 -06:00
|
|
|
@"registrationName": @"onError"
|
|
|
|
},
|
2015-04-08 02:58:00 -06:00
|
|
|
RNVideoEventProgress: @{
|
2015-04-06 14:05:05 -06:00
|
|
|
@"registrationName": @"onProgress"
|
|
|
|
},
|
2015-04-08 16:15:57 -06:00
|
|
|
RNVideoEventSeek: @{
|
|
|
|
@"registrationName": @"onSeek"
|
2015-04-10 20:56:51 -06:00
|
|
|
},
|
|
|
|
RNVideoEventEnd: @{
|
|
|
|
@"registrationName": @"onEnd"
|
2015-04-08 16:15:57 -06:00
|
|
|
}
|
2015-04-06 13:17:32 -06:00
|
|
|
};
|
2015-03-30 23:07:55 -06:00
|
|
|
}
|
|
|
|
|
2015-04-08 00:49:14 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
2015-04-04 18:55:37 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
2015-03-31 00:29:15 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
|
2015-04-07 21:38:16 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(volume, float);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(rate, float);
|
2015-04-09 07:50:20 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(seek, float);
|
2015-03-30 23:07:55 -06:00
|
|
|
|
|
|
|
- (NSDictionary *)constantsToExport
|
|
|
|
{
|
2015-05-10 17:01:25 -06:00
|
|
|
return @{
|
|
|
|
@"ScaleNone": AVLayerVideoGravityResizeAspect,
|
|
|
|
@"ScaleToFill": AVLayerVideoGravityResize,
|
|
|
|
@"ScaleAspectFit": AVLayerVideoGravityResizeAspect,
|
|
|
|
@"ScaleAspectFill": AVLayerVideoGravityResizeAspectFill
|
|
|
|
};
|
2015-03-30 23:07:55 -06:00
|
|
|
}
|
|
|
|
|
2015-04-06 13:17:32 -06:00
|
|
|
@end
|