2017-11-17 2 views
0

Ich entwickle eine App in objective-c.video spielen in UIView in ios

In meiner UIViewController

.h

Datei
@property(weak,nonatomic)IBOutlet UIView *vvv; 

.m-Datei

// to play the video 
    NSString *filepath = [[NSBundle mainBundle] pathForResource:@"alphabet learning splash" ofType:@"mp4"]; 
    NSURL *fileURL = [NSURL fileURLWithPath:filepath]; 


    self.avPlayer = [AVPlayer playerWithURL:fileURL]; 
    self.avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone; 
    AVPlayerLayer *videoLayer = [AVPlayerLayer playerLayerWithPlayer:self.avPlayer]; 

    [_vvv.layer addSublayer:videoLayer]; 
    [self.view addSubview:_vvv]; 
    [ self.avPlayer play]; 

Aber das Video Anzeige in der UIView von vvv.How ist nicht auf?

+0

Einstellung Haben Sie versucht, die Frames/Grenzen der Videoansicht einstellen? –

Antwort

0

Versuchen Sie, die Grenzen

// to play the video 
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"alphabet learning splash" ofType:@"mp4"]; 
NSURL *fileURL = [NSURL fileURLWithPath:filepath]; 


self.avPlayer = [AVPlayer playerWithURL:fileURL]; 
self.avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone; 
AVPlayerLayer *videoLayer = [AVPlayerLayer playerLayerWithPlayer:self.avPlayer]; 

[_vvv.layer addSublayer:videoLayer]; 
[self.view addSubview:_vvv]; 
_vvv.frame = self.bounds; 
[ self.avPlayer play]; 
+0

danke ..................... – jesteena

+0

Ich muss das Video wiederholen, bis der uiviewcontroller zum nächsten screen.how geht zu gehen – jesteena

+0

versuchen: self.avPlayer.actionAtItemEnd = AVPlayerActionAtItemEnd.play –