Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Formatting issues fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yarikk26 committed Nov 13, 2018
1 parent 7b8e55a commit 5531736
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static class VideoPlayer {
true);

dataSourceFactory = httpDataSourceFactory;
if(httpHeaders != null) {
if (httpHeaders != null) {
httpDataSourceFactory.getDefaultRequestProperties().set(httpHeaders);
}
}
Expand Down
18 changes: 11 additions & 7 deletions packages/video_player/ios/Classes/VideoPlayerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ @interface FLTVideoPlayer : NSObject<FlutterTexture, FlutterStreamHandler>
@property(nonatomic, readonly) bool isPlaying;
@property(nonatomic, readonly) bool isLooping;
@property(nonatomic, readonly) bool isInitialized;
- (instancetype)initWithURL:(NSURL*)url frameUpdater:(FLTFrameUpdater*)frameUpdater
- (instancetype)initWithURL:(NSURL*)url
frameUpdater:(FLTFrameUpdater*)frameUpdater
httpHeaders:(NSDictionary<NSString*, NSString*>*)headers;
- (void)play;
- (void)pause;
Expand All @@ -56,17 +57,19 @@ - (instancetype)initWithAsset:(NSString*)asset frameUpdater:(FLTFrameUpdater*)fr
return [self initWithURL:[NSURL fileURLWithPath:path] frameUpdater:frameUpdater httpHeaders:nil];
}

- (instancetype)initWithURL:(NSURL*)url frameUpdater:(FLTFrameUpdater*)frameUpdater
httpHeaders:(NSDictionary<NSString*, NSString*>*)headers{
- (instancetype)initWithURL:(NSURL*)url
frameUpdater:(FLTFrameUpdater*)frameUpdater
httpHeaders:(NSDictionary<NSString*, NSString*>*)headers {
self = [super init];
NSAssert(self, @"super init cannot be nil");
_isInitialized = false;
_isPlaying = false;
_disposed = false;

AVURLAsset* urlAsset = [AVURLAsset URLAssetWithURL:url options:@{@"AVURLAssetHTTPHeaderFieldsKey": headers}];

AVPlayerItem* item = [AVPlayerItem playerItemWithAsset:urlAsset];
AVURLAsset* urlAsset =
[AVURLAsset URLAssetWithURL:url options:@{@"AVURLAssetHTTPHeaderFieldsKey" : headers}];

AVPlayerItem* item = [AVPlayerItem playerItemWithAsset:urlAsset];
[item addObserver:self
forKeyPath:@"loadedTimeRanges"
options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew
Expand Down Expand Up @@ -346,7 +349,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
dataSource = argsMap[@"uri"];
NSDictionary<NSString*, NSString*>* httpHeaders = argsMap[@"httpHeaders"];
player = [[FLTVideoPlayer alloc] initWithURL:[NSURL URLWithString:dataSource]
frameUpdater:frameUpdater httpHeaders: httpHeaders];
frameUpdater:frameUpdater
httpHeaders:httpHeaders];
}
int64_t textureId = [_registry registerTexture:player];
frameUpdater.textureId = textureId;
Expand Down

0 comments on commit 5531736

Please sign in to comment.