Passing AVPlayer to another ViewController with no video other than sound

I am trying to pass AVPlayer to one tableviewcell to another View controller. I tested this on a simulator and it works, but when I tested it on an iPhone I can only hear audio, not video. My goal is to reduce loading times by using the same player, not the movie url, as I get the video from the internet and put it in the AVPlayer.

VideoDetailsViewController.h

@property (nonatomic, retain) AVPlayer *player;
@property (nonatomic, retain) IBOutlet VPVideoPlayer *videoPlayer;

      

VideoDetailsViewController.m

-(id)initWithAVPlayer:(AVPlayer*)player
{
if(self = [super initWithNibName:@"VideoDetailsViewController" bundle:nil]) {
_player = player;
}

return self;
}

- (void)viewDidLoad {
[super viewDidLoad];    
[self.videoPlayer setPlayer:self.player];
}

      

Parts of VideoPlayer.m

-(id)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame]) {

    }

return self;
}

+ (Class)layerClass
{
    return [AVPlayerLayer class];
}

- (AVPlayer*)player
{
    return [(AVPlayerLayer*)[self layer] player];
}

- (void)setPlayer:(AVPlayer*)player
{
    [(AVPlayerLayer*)[self layer] setPlayer:player];
}

      

thanks for the help

+3
ios objective-c avplayer


source to share


No one has answered this question yet

Check out similar questions:

1300
Transferring data between view controllers
1180
How can I check if a string contains another string in Objective-C?
440
Capturing an image using captureStillImageAsynchronouslyFromConnection without shutter sound
131
Launching video with AVFoundation AVPlayer?
1
Removing MKMapView annotations causes leak
0
Custom UIview class including firewall possible?
0
insertSubView: does not display my views
0
iPhone navigationController not showing
0
Custom UIButton does not change its image
-1
addSubview doesn't work



All Articles
Loading...
X
Show
Funny
Dev
Pics