You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2018/03/12 03:15:34 UTC
[2/3] incubator-weex git commit: [WEEX-241][iOS] add WXVideoComponent
"poster" attribute. Lazy load UIImageView property.
[WEEX-241][iOS] add WXVideoComponent "poster" attribute.
Lazy load UIImageView property.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b0e44554
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b0e44554
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b0e44554
Branch: refs/heads/master
Commit: b0e44554f107ee1d3456c08d655ab98ae3d3fdb1
Parents: 946bcec
Author: xuyouyang <xu...@corp.netease.com>
Authored: Thu Mar 8 13:41:48 2018 +0800
Committer: xuyouyang <xu...@corp.netease.com>
Committed: Thu Mar 8 13:41:48 2018 +0800
----------------------------------------------------------------------
.../Sources/Component/WXVideoComponent.m | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b0e44554/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
index 42c61e2..82b2be5 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
@@ -89,13 +89,6 @@
}
[self addSubview:_playerViewController.view];
-
- _posterImageView = [[UIImageView alloc] init];
- _posterImageView.userInteractionEnabled = YES;
- [_posterImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(posterTapHandler)]];
- _posterImageView.hidden = YES;
- [self addSubview:_posterImageView];
- [self bringSubviewToFront:_posterImageView];
}
return self;
}
@@ -158,7 +151,6 @@
videoFrame.origin.x = 0;
videoFrame.origin.y = 0;
[_playerViewController.view setFrame:videoFrame];
- [_posterImageView setFrame:videoFrame];
}
- (void)setURL:(NSURL *)URL
@@ -261,6 +253,18 @@
}
}
+- (UIImageView *)posterImageView {
+ if (!_posterImageView) {
+ _posterImageView = [[UIImageView alloc] initWithFrame:self.bounds];
+ _posterImageView.userInteractionEnabled = YES;
+ [_posterImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(posterTapHandler)]];
+ _posterImageView.hidden = YES;
+ [self addSubview:_posterImageView];
+ [self bringSubviewToFront:_posterImageView];
+ }
+ return _posterImageView;
+}
+
- (id<WXImgLoaderProtocol>)imageLoader
{
static id<WXImgLoaderProtocol> imageLoader;