I am new to Xcode,please help me out. I added AVPlayer in View Controller in IOS app.It displays Video in view But without audio. Any help anybody Advance thank you
the reason you audio is mute because you might have not initialize AVAudioSession Check this out ..
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
UIView *myView = previewView;
videoController = [[MPMoviePlayerViewController alloc]initWithContentURL:videoPlayUrl];
videoController.view.frame = myView.bounds;
[videoController.view setBounds:previewView.bounds];
videoController.moviePlayer.controlStyle = MPMovieControlStyleNone;
videoController.moviePlayer.scalingMode = MPMovieScalingModeFill;
videoController.moviePlayer.shouldAutoplay = NO;
videoController.view.clipsToBounds = YES;
[previewView.layer addSublayer:videoController.view.layer];
[videoController.moviePlayer prepareToPlay];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.