【问题标题】:iframe on IOS cropping webviewIOS裁剪webview上的iframe
【发布时间】:2015-08-20 10:03:43
【问题描述】:

我正在尝试使用 YTPlayerView 嵌入 youtube 视频,因此设置其框架并加载内容,但视频正在被裁剪:

-(void)viewDidLoad{
    [super viewDidLoad];
    NSDictionary *playerVars = @{
                             @"controls" : @0,
                             @"playsinline" : @1,
                             @"autohide" : @1,
                             @"showinfo" : @0,
                             @"modestbranding" : @1
                             };
    [self.view addSubview:self.playerView];
    [self.view addSubview:self.slider];
    [self.view addSubview:self.playButton];
    self.view.backgroundColor = [UIColor blackColor];
    self.playerView.delegate = self;
    [self.playerView loadWithVideoId:self.videoId playerVars:playerVars];
}

-(YTPlayerView *)playerView{
    if (!_playerView) {
        _playerView = [[YTPlayerView alloc] initWithFrame:CGRectMake(10, 84,      self.view.frame.size.width - 10, 250)];
    }
    return _playerView;
}

有什么方法可以正确填充视图?

【问题讨论】:

  • 您是否尝试过按照this 答案中的建议更改样式?
  • 默认的 YTPlayerView-.html 已经在 标签中有这些值

标签: ios youtube-api


【解决方案1】:

_playerView.contentMode = UIViewContentModeScaleAspectFit;

在创建 YTPlayerView 的对象之后放置。可能是它的作品。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-12
    • 2021-09-10
    • 1970-01-01
    • 2016-06-16
    • 2011-10-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多