Giter Site home page Giter Site logo

Comments (8)

chrisjp avatar chrisjp commented on August 30, 2024

Hmm, just a quick thought off the top of my head right now... could you try adding the following override method into the view controller that you launch the video from (assuming you don't already have this):

- (BOOL)prefersStatusBarHidden {
    return NO;
}

I'm not sure if that will fix it or not but it's the only thing I can think of right now. If it doesn't, I will try and look into this more later.

from cjpadcontroller.

estemendoza avatar estemendoza commented on August 30, 2024

I tried that method and it didn't work, sorry

from cjpadcontroller.

chrisjp avatar chrisjp commented on August 30, 2024

Hey, I just tried some basic code to play a video within the demo app of CJPAdController. I have set it up as you described; launch video fullscreen, play video, click the done button or wait until it's finished. Tried it on both the iPhone and iPad 7.1 Simulators, and it seems to work fine - the status bar is still there when returning to the view.

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"nameOfVideoFile" ofType:@"mov"]];
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
_moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:YES];
[_moviePlayer play];

If you're using different code can you let me know what it looks like as it seems I'm unable to reproduce this bug at the moment!?

from cjpadcontroller.

estemendoza avatar estemendoza commented on August 30, 2024

I use a lib wrapper for youtube videos called LBYouTubePlayerController that use MPMoviePlayerController internally, so I think it should be the same, but here's the code that I'm using.

Other thing that I didn't mention is that I'm using CJPAdController with a tabbar which has a navigation controller on the views inside the tabbar items.

the .h file

@interface videoController : UIViewController<LBYouTubePlayerControllerDelegate>{
    LBYouTubePlayerController* controller;
}
@property (nonatomic, strong) LBYouTubePlayerController* controller;

the .m file

- (void)viewDidAppear:(BOOL)animated{

    if (controller.playbackState != MPMoviePlaybackStatePlaying && controller.playbackState != MPMoviePlaybackStatePaused) {
        controller = [[LBYouTubePlayerController alloc] initWithYouTubeURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@", url_video]] quality:LBYouTubeVideoQualityLarge];
        controller.delegate = self;
        controller.repeatMode = MPMovieRepeatModeNone;
        //controller.controlStyle = MPMovieControlStyleEmbedded;
        CGRect f = self.view.frame;
        controller.view.frame = CGRectMake(0,0,f.size.width, f.size.height);
        [self.view addSubview:controller.view];
        controller.allowsAirPlay = YES;


    }

}

from cjpadcontroller.

estemendoza avatar estemendoza commented on August 30, 2024

Just a quick update, this issue is only on iOS 7, with iOS 6 the status bar is displayed correctly

from cjpadcontroller.

estemendoza avatar estemendoza commented on August 30, 2024

I temporary fix it by adding the key "View controller-based status bar appearance" = NO on info.plist, but I suppose this is not a permanent fix for the tool

from cjpadcontroller.

chrisjp avatar chrisjp commented on August 30, 2024

Oh I totally forgot about that plist entry and that it's not in there by default. Sorry it completely slipped my mind! But you will need it.
If you set that plist key to YES and then use the prefersStatusBarHidden method that I posted earlier in the view controller it should work. Doing it this way is preferred as you can then easily control which view controllers should have the status bar hidden and which should show it.

If that doesn't work you it may be because it's not getting called automatically for some reason, so you might need to force it to be called with [self setNeedsStatusBarAppearanceUpdate]. Assuming you have a notification sent when the video has finished playing, you should call it then.

Let me know if this works. If it does I'll add a note to the readme about that plist key when making use of those view controller based overrides so other people don't get this problem.

from cjpadcontroller.

estemendoza avatar estemendoza commented on August 30, 2024

Yes, that worked fine! Setting the plist key to YES and calling prefersStatusBarHidden seems to do the trick. Thanks!

from cjpadcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.