我正在开发一个应用程序,我正在从url播放视频 . 我正在小窗口中显示该视频 . 我正在以横向模式播放视频 . 请看快照 .
Image Here

现在我有两个问题

  • 视频上的UI控件未缩放为小尺寸 .

  • 当我以全屏模式观看视频时,它会自动旋转到纵向模式 . 因此,只有在全屏查看时才可以以横向模式播放 .

code to play video

NSURL *fileURL = [NSURL URLWithString:@"http://www.w3schools.com/html/movie.mp4"];
    self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
    CGRect movieFrame;
    movieFrame.size = self.videoView.frame.size;
    [self.moviePlayerController.view setFrame:movieFrame];
    [self.moviePlayerController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.videoView addSubview:self.moviePlayerController.view];
    [self.videoView bringSubviewToFront:self.moviePlayerController.view];
    [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                          attribute:NSLayoutAttributeBottom
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.videoView
                                                          attribute:NSLayoutAttributeBottom
                                                         multiplier:1.0
                                                           constant:0.0]];
        [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                          attribute:NSLayoutAttributeTrailing
                                                          relatedBy:NSLayoutRelationEqual
                                                             toItem:self.videoView
                                                          attribute:NSLayoutAttributeTrailing
                                                         multiplier:1.0
                                                           constant:0.0]];
    [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                               attribute:NSLayoutAttributeLeading
                                                               relatedBy:NSLayoutRelationEqual
                                                                  toItem:self.videoView
                                                               attribute:NSLayoutAttributeLeading
                                                              multiplier:1.0
                                                                constant:0.0]];
        [self.videoView addConstraint:[NSLayoutConstraint constraintWithItem:self.moviePlayerController.view
                                                               attribute:NSLayoutAttributeTop
                                                               relatedBy:NSLayoutRelationEqual
                                                                  toItem:self.videoView
                                                               attribute:NSLayoutAttributeTop
                                                              multiplier:1.0
                                                                constant:0.0]];
 [self.moviePlayerController play];