[ 
https://issues.apache.org/jira/browse/WEEX-645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16651378#comment-16651378
 ] 

ASF GitHub Bot commented on WEEX-645:
-------------------------------------

cxfeng1 closed pull request #1636: [WEEX-645][iOS] videocomponent support hide 
controls
URL: https://github.com/apache/incubator-weex/pull/1636
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m 
b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
index 483f838c19..a9cb1bfda1 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
@@ -39,9 +39,9 @@ @implementation WXPlayer
 
 @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)setURL:(NSURL *)URL
     }
 }
 
-- (void)setPosterURL:(NSURL *)posterURL {
+- (void)setPosterURL:(NSURL *)posterURL
+{
     if (!posterURL) {
         return;
     }
@@ -213,6 +214,19 @@ - (void)setPosterURL:(NSURL *)posterURL {
     }];
 }
 
+- (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 @@ @interface WXVideoComponent()
 @property (nonatomic, strong) NSURL *posterURL;
 @property (nonatomic) BOOL autoPlay;
 @property (nonatomic) BOOL playStatus;
+@property (nonatomic) BOOL showControl;
 
 @end
 
@@ -316,6 +331,9 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString 
*)type styles:(NSDict
         if (attributes[@"poster"]) {
             _posterURL = [NSURL URLWithString: attributes[@"poster"]];
         }
+        if (attributes[@"controls"]) {
+            _showControl = ![attributes[@"controls"] 
isEqualToString:@"controls"];
+        }
     }
     return self;
 }
@@ -333,6 +351,7 @@ - (void)viewDidLoad
     _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)viewDidLoad
     }
 }
 
--(void)updateAttributes:(NSDictionary *)attributes
+- (void)updateAttributes:(NSDictionary *)attributes
 {
     if (attributes[@"src"]) {
         _videoURL = [NSURL URLWithString: attributes[@"src"]];
@@ -392,6 +411,10 @@ -(void)updateAttributes:(NSDictionary *)attributes
         _posterURL = [NSURL URLWithString: attributes[@"poster"]];
         [_videoView setPosterURL:_posterURL];
     }
+    if (attributes[@"controls"]) {
+        _showControl = ![attributes[@"controls"] isEqualToString:@"controls"];
+        [_videoView setControlShow:_showControl];
+    }
 }
 
 @end


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> video can hide controls
> -----------------------
>
>                 Key: WEEX-645
>                 URL: https://issues.apache.org/jira/browse/WEEX-645
>             Project: Weex
>          Issue Type: Bug
>            Reporter: qz
>            Assignee: qz
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to