diff --git a/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java b/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java index a6b07f10f6b3..c210b1b28857 100644 --- a/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java +++ b/packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java @@ -93,7 +93,7 @@ private static class VideoPlayer { true); dataSourceFactory = httpDataSourceFactory; - if(httpHeaders != null) { + if (httpHeaders != null) { httpDataSourceFactory.getDefaultRequestProperties().set(httpHeaders); } } diff --git a/packages/video_player/ios/Classes/VideoPlayerPlugin.m b/packages/video_player/ios/Classes/VideoPlayerPlugin.m index ad98382eeae6..97eb68fbbf7e 100644 --- a/packages/video_player/ios/Classes/VideoPlayerPlugin.m +++ b/packages/video_player/ios/Classes/VideoPlayerPlugin.m @@ -36,7 +36,8 @@ @interface FLTVideoPlayer : NSObject @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*)headers; - (void)play; - (void)pause; @@ -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*)headers{ +- (instancetype)initWithURL:(NSURL*)url + frameUpdater:(FLTFrameUpdater*)frameUpdater + httpHeaders:(NSDictionary*)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 @@ -346,7 +349,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { dataSource = argsMap[@"uri"]; NSDictionary* 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;