diff --git a/RNGoogleIMA.podspec b/RNGoogleIMA.podspec index a8e71f8..279888f 100644 --- a/RNGoogleIMA.podspec +++ b/RNGoogleIMA.podspec @@ -11,13 +11,13 @@ Pod::Spec.new do |s| s.license = "MIT" # s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.authors = { "Sid Ferreira" => "sid@ted.com" } - s.platform = :ios, "9.0" + s.platform = :ios, "13.0" s.source = { :git => "https://github.com/tedconf/react-native-google-ima.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,swift}" s.requires_arc = true s.dependency "React" - s.dependency 'GoogleAds-IMA-iOS-SDK', '~> 3.11.2' + s.dependency 'GoogleAds-IMA-iOS-SDK', '~> 3.22.1' end diff --git a/ios/RNGoogleIMA.m b/ios/RNGoogleIMA.m index 5d4aab3..1e63205 100644 --- a/ios/RNGoogleIMA.m +++ b/ios/RNGoogleIMA.m @@ -148,8 +148,15 @@ -(void) configure:(RCTVideo *) rctVideo if (rctVideo) { _rctVideo = rctVideo; _rctVideo.rctVideoDelegate = self; - // Create an ad display container for ad rendering. - _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView companionSlots:nil]; + if (_adContainerView) { + _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView + viewController:self + companionSlots:nil]; + } else { + _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView + viewController:self + companionSlots:nil]; + } } } @@ -169,9 +176,7 @@ - (void)invalidatePlayer _streamManager = nil; } if (_avPlayerVideoDisplay != nil) { - if (_avPlayerVideoDisplay.player != nil) { - [_avPlayerVideoDisplay.player pause]; - } + [_avPlayerVideoDisplay pause]; _avPlayerVideoDisplay = nil; } if (_adsManager != nil) { @@ -198,7 +203,7 @@ -(BOOL) shouldSetupPlayerItem:(AVPlayerItem *) playerItem forSource:(NSDictionar // if (!_contentPlayer) { [self invalidatePlayer]; - _contentPlayer = [AVPlayer playerWithPlayerItem:nil]; + _contentPlayer = [AVPlayer playerWithPlayerItem:_fallbackPlayerItem]; [_contentPlayer pause]; [_contentPlayer setRate:0]; @@ -240,12 +245,14 @@ - (void)requestStreamForSource:(NSDictionary *)source { // Live stream request. request = [[IMALiveStreamRequest alloc] initWithAssetKey:_assetKey adDisplayContainer:_adDisplayContainer - videoDisplay:_avPlayerVideoDisplay]; + videoDisplay:_avPlayerVideoDisplay + userContext:nil]; } else { request = [[IMAVODStreamRequest alloc] initWithContentSourceID:_contentSourceID videoID:_videoID adDisplayContainer:_adDisplayContainer - videoDisplay:_avPlayerVideoDisplay]; + videoDisplay:_avPlayerVideoDisplay + userContext:nil]; } [request setAdTagParameters:_adTagParameters]; @@ -378,8 +385,8 @@ - (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAd [_contentPlayer pause]; [_avPlayerVideoDisplay pause]; - AVPlayer* player = _avPlayerVideoDisplay.player; - AVPlayerItem* playerItem = _avPlayerVideoDisplay.playerItem; + AVPlayer* player = _contentPlayer; + AVPlayerItem* playerItem = _fallbackPlayerItem; [_rctVideo setupPlayerItem:playerItem forSource:_source withPlayer:player]; [_rctVideo observeValueForKeyPath:statusKeyPath ofObject:playerItem change:nil context:nil]; break; diff --git a/ios/RNGoogleIMA.xcodeproj/project.pbxproj b/ios/RNGoogleIMA.xcodeproj/project.pbxproj index 44b3550..9a55623 100644 --- a/ios/RNGoogleIMA.xcodeproj/project.pbxproj +++ b/ios/RNGoogleIMA.xcodeproj/project.pbxproj @@ -226,12 +226,14 @@ 58B511F01A9E6C8500147676 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../../React/**", "$(SRCROOT)/../../react-native/React/**", ); + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNGoogleIMA; @@ -242,13 +244,16 @@ 58B511F11A9E6C8500147676 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../../React/**", "$(SRCROOT)/../../react-native/React/**", ); + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNGoogleIMA; SKIP_INSTALL = YES; diff --git a/package.json b/package.json index 3b7672f..39055b6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-google-ima", "title": "React Native Google IMA", - "version": "0.4.2", + "version": "0.5.1", "description": "Google IMA for React Native", "summary": "TODO", "main": "index.js", @@ -26,7 +26,7 @@ "peerDependencies": { "prop-types": "^15", "deprecated-react-native-prop-types": "^2.3.0", - "react-native-video": "https://github.com/tedconf/react-native-video.git#RCTVideoDelegate" + "react-native-video": "git+ssh://git@github.com:tedconf/react-native-video.git#RCTVideoDelegate-5.2.0-22Sep13_01_IOS14Fix_RN_0-70" }, "devDependencies": {}, "dependencies": {}