나는 video.I 마침내 내가 code.It 지금은 잘 작동 아래로 갔다 helped.Then 방법 아무것도하지만 많이 노력 재생에 문제가 있었다. iOS 10을 사용합니다 .So AVPlayerViewController를 사용합니다. MPMoviePlayerViewController는 더 이상 사용되지 않습니다..
ViewController.h
#import <UIKit/UIKit.h>
#import <AVKit/AVKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) AVPlayerViewController *playerViewController;
- (IBAction)actionPlayVideo:(id)sender
@end
ViewController.m
#import "ViewController.h"
@interface ViewController(){
NSURL *vedioURL;
}
@end
@implementation ViewController
@synthesize playerViewController;
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)actionPlayVideo:(id)sender
{
vedioURL = @"192.168.0.1/user/root/Sample.mp4";
AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:vedioURL];
AVPlayer* playVideo = [[AVPlayer alloc] initWithPlayerItem:playerItem];
playerViewController = [[AVPlayerViewController alloc] init];
playerViewController.player = playVideo;
playerViewController.player.volume = 0;
playerViewController.view.frame = self.view.bounds;
[self.view addSubview:playerViewController.view];
[playVideo play];
}
아이폰, 아이 패드 또는 아이팟
에 문의하십시오 확인 장치가 웹 브라우저의 동일한 네트워크에 연결되어 있는지 확인 . –
정보 plist에 앱 전송 보안 추가 – Rivendell
moviePlayerController = [[MPMoviePlayerViewController alloc] initWithContentURL : url]; [self presentMoviePlayerViewControllerAnimated : moviePlayerController]; [moviePlayerController.moviePlayer play]; –