2015-03-30 22:07:55 -07:00
|
|
|
#import "RCTVideoManager.h"
|
|
|
|
#import "RCTVideo.h"
|
2017-01-11 13:43:43 +01:00
|
|
|
#import <React/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-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);
|
2018-06-06 09:40:12 +08:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);
|
2018-06-02 02:24:13 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
|
2015-04-07 20:38:16 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
|
2015-12-22 17:39:04 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(controls, BOOL);
|
2015-04-07 20:38:16 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(volume, float);
|
2015-10-30 10:34:54 +01:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(playInBackground, BOOL);
|
2016-04-29 14:16:21 +02:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(playWhenInactive, BOOL);
|
2017-04-20 13:10:06 -05:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(ignoreSilentSwitch, NSString);
|
2015-04-07 20:38:16 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(rate, float);
|
2018-06-20 22:09:45 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(seek, NSDictionary);
|
2015-12-22 17:39:04 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(currentTime, float);
|
2016-03-31 20:36:39 +02:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
|
2016-10-01 11:23:50 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(progressUpdateInterval, float);
|
2016-12-13 00:16:11 +00:00
|
|
|
/* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoLoadStart, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTBubblingEventBlock);
|
2017-01-11 12:51:45 +00:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoBuffer, RCTBubblingEventBlock);
|
2016-12-13 00:16:11 +00:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoError, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoProgress, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoSeek, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoEnd, RCTBubblingEventBlock);
|
2017-02-14 03:38:02 +01:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onTimedMetadata, RCTBubblingEventBlock);
|
2016-12-13 00:16:11 +00:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillPresent, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidPresent, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillDismiss, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidDismiss, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onReadyForDisplay, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPlaybackStalled, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPlaybackResume, RCTBubblingEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onPlaybackRateChange, RCTBubblingEventBlock);
|
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
|
|
|
}
|
|
|
|
|
2017-12-07 19:35:32 +01:00
|
|
|
+ (BOOL)requiresMainQueueSetup
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2015-04-06 12:17:32 -07:00
|
|
|
@end
|