ho raggiunto l'obiettivo con il nativo AVPlayer
1.Used AVFoundation:
#import <AVFoundation/AVFoundation.h>
2.Used proprietà per il giocatore:
@property (nonatomic) AVPlayer *avPlayer;
3.Added file video in "Video" cartella e ha aggiunto "Video" in progetto
4.Initialized il giocatore
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"shutterstock_v885172.mp4" ofType:nil inDirectory:@"Video"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
self.avPlayer = [AVPlayer playerWithURL:fileURL];
self.avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone;
AVPlayerLayer *videoLayer = [AVPlayerLayer playerLayerWithPlayer:self.avPlayer];
videoLayer.frame = self.view.bounds;
videoLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.view.layer addSublayer:videoLayer];
[self.avPlayer play];
5.Subscribed per l'evento - il video ha giocato fino alla fine
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:[self.avPlayer currentItem]];
il video 6.Resumed giocare fin dall'inizio in modo correlato
- (void)itemDidFinishPlaying:(NSNotification *)notification {
AVPlayerItem *player = [notification object];
[player seekToTime:kCMTimeZero];
}
fonte
2016-03-14 16:47:14
È Video locale o YouTube Video che utilizza URL? – Vidhyanand
sarà il file locale importato nel progetto. In realtà ci saranno più file (video) ciascuno per ViewController separata –
Fare riferimento http://stackoverflow.com/questions/17922017/display-video-inside-the-uiwebview-not-in-device-full-screen – Vidhyanand