68 lines
1.6 KiB
Objective-C
68 lines
1.6 KiB
Objective-C
#import "RCTVideoManager.h"
|
|
#import "RCTVideo.h"
|
|
#import "RCTBridge.h"
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
@implementation RCTVideoManager
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
@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 @{
|
|
RNVideoEventLoading: @{
|
|
@"registrationName": @"onVideoLoadStart"
|
|
},
|
|
RNVideoEventLoaded: @{
|
|
@"registrationName": @"onVideoLoad"
|
|
},
|
|
RNVideoEventLoadingError: @{
|
|
@"registrationName": @"onVideoError"
|
|
},
|
|
RNVideoEventProgress: @{
|
|
@"registrationName": @"onVideoProgress"
|
|
},
|
|
RNVideoEventSeek: @{
|
|
@"registrationName": @"onVideoSeek"
|
|
},
|
|
RNVideoEventEnd: @{
|
|
@"registrationName": @"onVideoEnd"
|
|
}
|
|
};
|
|
}
|
|
|
|
- (dispatch_queue_t)methodQueue
|
|
{
|
|
return dispatch_get_main_queue();
|
|
}
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
|
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
|
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);
|
|
|
|
- (NSDictionary *)constantsToExport
|
|
{
|
|
return @{
|
|
@"ScaleNone": AVLayerVideoGravityResizeAspect,
|
|
@"ScaleToFill": AVLayerVideoGravityResize,
|
|
@"ScaleAspectFit": AVLayerVideoGravityResizeAspect,
|
|
@"ScaleAspectFill": AVLayerVideoGravityResizeAspectFill
|
|
};
|
|
}
|
|
|
|
@end
|