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