Skip to content

Commit

Permalink
fix(ios): amend TiMediaVideoPlayer parent controller (#13011)
Browse files Browse the repository at this point in the history
Fixes TIMOB-28518
  • Loading branch information
garymathews authored Sep 2, 2021
1 parent ffc24c0 commit eb319ef
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions iphone/Classes/TiMediaVideoPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ - (void)setMovie:(AVPlayerViewController *)controller_
// don't add the movie more than once if the same
return;
}
[controller willMoveToParentViewController:nil];
[[controller view] removeFromSuperview];
[controller removeFromParentViewController];
[spinner removeFromSuperview];
RELEASE_TO_NIL(spinner);
RELEASE_TO_NIL(controller);
Expand All @@ -75,24 +73,10 @@ - (void)setMovie:(AVPlayerViewController *)controller_
}
controller = [controller_ retain];

// Set parent for AVPlayerViewController controller
if (!parentController) {
id proxy = [(TiViewProxy *)self.proxy parent];
while (proxy != nil && ![proxy isKindOfClass:[TiWindowProxy class]]) {
proxy = [proxy parent];
}
if (proxy != nil) {
parentController = [[(TiWindowProxy *)proxy windowHoldingController] retain];
} else {
parentController = [[[TiApp app] controller] retain];
}
}

[parentController addChildViewController:controller];
[TiUtils setView:[controller view] positionRect:self.bounds];
[self addSubview:[controller view]];
[self sendSubviewToBack:[controller view]];
[controller didMoveToParentViewController:parentController];

[TiUtils setView:[controller view] positionRect:self.bounds];

TiColor *bgcolor = [TiUtils colorValue:[self.proxy valueForKey:@"backgroundColor"]];
UIActivityIndicatorViewStyle style = UIActivityIndicatorViewStyleGray;
Expand Down

0 comments on commit eb319ef

Please sign in to comment.