You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2018/10/16 09:18:50 UTC
[incubator-weex] branch master updated: [WEEX-645][iOS] video can
hide controls (#1636)
This is an automated email from the ASF dual-hosted git repository.
cxfeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new 4fe0c41 [WEEX-645][iOS] video can hide controls (#1636)
4fe0c41 is described below
commit 4fe0c417fb7d78c799330e48eeff008a8d0b31f4
Author: Douma Fang <do...@gmail.com>
AuthorDate: Tue Oct 16 17:18:44 2018 +0800
[WEEX-645][iOS] video can hide controls (#1636)
---
.../WeexSDK/Sources/Component/WXVideoComponent.m | 33 ++++++++++++++++++----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
index 483f838..a9cb1bf 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
@@ -39,9 +39,9 @@
@interface WXVideoView()
-@property (nonatomic, strong) UIViewController* playerViewController;
-@property (nonatomic, strong) AVPlayerItem* playerItem;
-@property (nonatomic, strong) WXSDKInstance* weexSDKInstance;
+@property (nonatomic, strong) UIViewController *playerViewController;
+@property (nonatomic, strong) AVPlayerItem *playerItem;
+@property (nonatomic, strong) WXSDKInstance *weexSDKInstance;
@property (nonatomic, strong) UIImageView *posterImageView;
@property (nonatomic, strong) id<WXImageOperationProtocol> imageOperation;
@property (nonatomic, assign) BOOL playerDidPlayed;
@@ -192,7 +192,8 @@
}
}
-- (void)setPosterURL:(NSURL *)posterURL {
+- (void)setPosterURL:(NSURL *)posterURL
+{
if (!posterURL) {
return;
}
@@ -213,6 +214,19 @@
}];
}
+- (void)setControlShow:(BOOL)showControl
+{
+ if ([self greater8SysVer]) {
+ AVPlayerViewController *AVVC = (AVPlayerViewController*)_playerViewController;
+ AVVC.showsPlaybackControls = showControl;
+ }
+ else
+ {
+ MPMoviePlayerViewController *MPVC = (MPMoviePlayerViewController*)_playerViewController;
+ MPVC.moviePlayer.controlStyle = showControl ? MPMovieControlStyleEmbedded : MPMovieControlStyleNone;
+ }
+}
+
- (void)playFinish
{
if (_playbackStateChanged)
@@ -293,6 +307,7 @@
@property (nonatomic, strong) NSURL *posterURL;
@property (nonatomic) BOOL autoPlay;
@property (nonatomic) BOOL playStatus;
+@property (nonatomic) BOOL showControl;
@end
@@ -316,6 +331,9 @@
if (attributes[@"poster"]) {
_posterURL = [NSURL URLWithString: attributes[@"poster"]];
}
+ if (attributes[@"controls"]) {
+ _showControl = ![attributes[@"controls"] isEqualToString:@"controls"];
+ }
}
return self;
}
@@ -333,6 +351,7 @@
_videoView.layer.mask = [self drawBorderRadiusMaskLayer:_videoView.bounds];
[_videoView setURL:_videoURL];
[_videoView setPosterURL:_posterURL];
+ [_videoView setControlShow:_showControl];
__weak __typeof__(self) weakSelf = self;
_videoView.posterClickHandle = ^{
@@ -370,7 +389,7 @@
}
}
--(void)updateAttributes:(NSDictionary *)attributes
+- (void)updateAttributes:(NSDictionary *)attributes
{
if (attributes[@"src"]) {
_videoURL = [NSURL URLWithString: attributes[@"src"]];
@@ -392,6 +411,10 @@
_posterURL = [NSURL URLWithString: attributes[@"poster"]];
[_videoView setPosterURL:_posterURL];
}
+ if (attributes[@"controls"]) {
+ _showControl = ![attributes[@"controls"] isEqualToString:@"controls"];
+ [_videoView setControlShow:_showControl];
+ }
}
@end