I am trying to show live streaming in bottom left corner of my screen,Currently live video is playing smoothly with all controls(Play, pause ,volume,full screen).But close/done button is not there.so I am not able to close live streaming window at any time I want to close it.I am using AVPlayer to achive same .Below is my code.
I have tried MPPlayer also but had same problem with that.
I had taken one close button and tried playerlayer.removefromsuperlayer but this also not worked for me.
I just want one close button which will close live streaming from my app
Please suggest any another player if they support close functionality
NSURL *videourl = [NSURL URLWithString:@"my url"];
AVPlayer *player = [AVPlayer playerWithURL:videourl];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = player;
playerViewController.view.frame = CGRectMake(0, 400, 300, 200);
AVPlayerLayer* playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
playerLayer.frame = CGRectMake(0, 400, 300, 200);
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
//externalPlaybackVideoGravity
playerLayer.contentsGravity = AVLayerVideoGravityResizeAspect;
playerViewController.showsPlaybackControls = YES;
[self addChildViewController:playerViewController];
[self.view.layer addSublayer:playerLayer];
[self.view addSubview:playerViewController.view];
playerViewController.player.muted = TRUE;
[playerViewController.player play];