- Home /
'Done' button missing | Video Playback iOS 9.2
Hey there,
since upgrading to iOS 9.2 the videos being played with:
Handheld.PlayFullScreenMovie(url, Color.black, FullScreenMovieControlMode.Full);
do not show a 'done' button anymore to stop the video. Am I missing something, or does somebody know a solution to this problem?
Thank you in advance.
Answer by Halloween_Udo · Jan 07, 2016 at 10:15 AM
I'm sorry to inform you that the above code does not work anymore.
But there is a workaround for this:
Change to onPlayerReady() method as mentioned above. This will present the player with the missing done button. Unfortunately you can't access the callback of it.
To stop the video, I did put the cancelOnTouch layer they use over the done button. To do this use:
UIView* videoView = cancelOnTouchView = [[CancelOnTouchView alloc] initWithOnTouchBlock:^(){
if(_AVKitVideoPlayback)
[_AVKitVideoPlayback finish];
}];
cancelOnTouchView.frame = CGRectMake(10, 22, 50, 21);
//cancelOnTouchView.backgroundColor = [UIColor brownColor];
//cancelOnTouchView.alpha = 0.5f;
[videoViewController.view addSubview:videoView];
It should be positioned correctly for the landscape orientation on all iOS devices. If you are playing in Portrait uncomment the lines and see for yourself.
If you run into any problems post here as I might have forgotten something. I hope not.
EDIT: You have to put that code snipped into actuallyStartTheMovie(NSURL*)url Put in under the allocation of videoViewController.
Happy new year.
EDIT-EDIT: the posts got rearranged, so you will find the code of the onPLayerReady() Method below this post.
Answer by Halloween_Udo · Dec 16, 2015 at 09:37 AM
Unclean fix
Put in FullScreenVideoPlayer.mm under Classes > Unity in your xCode Project:
@interface VideoViewController : AVPlayerViewController{}
@end
@implementation VideoViewController
- (void) viewWillDisappear:(BOOL)animated {
[_AVKitVideoPlayback finish];
[super viewWillDisappear:animated];
}
@end
under the static reference of AVKitVideoPlayback. Now you have to change _AVPlayerViewControllerClass to VideoViewController in actuallyStartTheMovie().
Also change your onPlayerReady Function to
- (void)onPlayerReady
{
if (!videoViewController.player)
{
videoViewController.player = videoPlayer.player;
[GetAppController().rootViewController presentViewController:videoViewController animated:NO completion:nil];
[videoPlayer playVideoPlayer];
}
}
This does not seem right, but it works. So use it or make it clean and post here. I would appreciate it. Thank you.
I'm experiencing same issue; seriously, this looks like a major bug in Unity, it should be filed as a bug and fixed properly on their end.