Skip to content

Commit

Permalink
更新0.4.4版本,iOS插件优化横竖屏适配功能和无法隐藏跑马灯的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
彭云飞 committed Apr 23, 2021
1 parent a2a0e3f commit 0f52280
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
32 changes: 25 additions & 7 deletions ios/PolyvVodRnModule/PolyvVodPlayerWrapperView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ @interface PolyvVodPlayerWrapperView ()

@property (nonatomic, strong) NSString *vid;
@property (nonatomic, strong) PLVVodSkinPlayerController *player;
@property (nonatomic, assign) CGRect fullScreenRect;

@property CGRect orginRect;
@property CGRect fullScreenRect;

@end

Expand All @@ -38,12 +38,16 @@ - (void)setup {

self.orginRect = CGRectZero;

CGRect screenBounds = [UIScreen mainScreen].bounds;
CGFloat screenWidth = screenBounds.size.width;
CGFloat screenHeight = screenBounds.size.height;
self.fullScreenRect = CGRectMake(0, 0, screenHeight, screenWidth);

self.player.wrapperView = self;

//根据进入时屏幕横竖屏判断
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (orientation == UIInterfaceOrientationUnknown ||
orientation == UIInterfaceOrientationPortrait) {
//横屏
} else {
[self setFullScreen];
}
}

- (void)setPlay_parameters:(NSDictionary *)play_parameters {
Expand Down Expand Up @@ -90,6 +94,8 @@ - (void)setPlay_parameters:(NSDictionary *)play_parameters {
marquee.alpha = [alpha floatValue];
marquee.font = [UIFont systemFontOfSize:[font floatValue]];
self.player.marquee = marquee;
} else {
self.player.marquee = nil;
}
}
}
Expand All @@ -98,7 +104,7 @@ - (void)setPlay_parameters:(NSDictionary *)play_parameters {
- (void)switchToFullScreen:(BOOL)fullScreen {
NSLog(@"switchToFullScreen - %@", self);
if (CGRectEqualToRect(self.orginRect, CGRectZero)) {
self.orginRect = self.player.view.frame;
self.orginRect = self.bounds;
}

if (fullScreen) {
Expand Down Expand Up @@ -190,6 +196,7 @@ - (void)setFullScreen:(BOOL)fullScreen {
} else {
if (fullScreen) {
[self.player.playerControl.fullShrinkscreenButton sendActionsForControlEvents:UIControlEventTouchUpInside];
[self switchToFullScreen:YES];
}
}
});
Expand Down Expand Up @@ -242,4 +249,15 @@ - (UIColor *)colorWithHexStringRGB:(NSString *)hexColor {
alpha:1.0f];
}

#pragma mark -- getter
- (CGRect)fullScreenRect {
CGRect screenBounds = [UIScreen mainScreen].bounds;
CGFloat screenWidth = screenBounds.size.width;
CGFloat screenHeight = screenBounds.size.height;
if (screenHeight > screenWidth) {
return CGRectMake(0, 0, screenHeight, screenWidth);
}
return CGRectMake(0, 0, screenWidth, screenHeight);
}

@end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "PolyvVodRnDemo",
"version": "0.4.3",
"version": "0.4.4",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
Expand Down

0 comments on commit 0f52280

Please sign in to comment.