Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.5.1 #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RNGoogleIMA.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

27 changes: 17 additions & 10 deletions ios/RNGoogleIMA.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

}
}
Expand All @@ -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) {
Expand All @@ -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];

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions ios/RNGoogleIMA.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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": {}
Expand Down