Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:41:28+00:00 2026-06-16T07:41:28+00:00

I present one controller to play video: [self presentModalViewController:movieController animated:YES]; and add an observer

  • 0

I present one controller to play video:

  [self presentModalViewController:movieController animated:YES];

and add an observer when finish palying:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedPlayback:) 
name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
    }

    -(void) movieFinishedPlayback:(NSNotification*)notification{
        NSLog(@"........movieFinishedPlayback....... \n ");
        [self dismissModalViewControllerAnimated:YES];
        [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
    }

This my VideoDetailViewController:

#import "VideoDetailViewController.h"
#import "PSStackedView.h"
#import "YunMaoIpadAppDelegate.h"

#define IpadAppDelegate ((YunMaoIpadAppDelegate *)[[UIApplication sharedApplication] delegate])
#define IphoneAppDelegate ((YunMaoIosAppDelegate *)[[UIApplication sharedApplication] delegate])

@interface VideoDetailViewController ()

@end

@implementation VideoDetailViewController

@synthesize video, moviePlayer, collectionsArray;

-(id)initWithVideo:(Video *)theVideo
{
    self = [super initWithNibName:@"VideoDetailViewController" bundle:nil];
    if (self) {
        self.video = theVideo;
    }
    return self;
}
- (void)viewWillDisappear:(BOOL)animated
{
    [moviePlayer pause];
    //[self.navigationController setNavigationBarHidden:false animated:animated];
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated;
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

    [super viewDidDisappear:animated];
}

- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.view.backgroundColor = [UIColor blackColor];
}

- (void) viewDidAppear:(BOOL)animated
{
    //[moviePlayer play];
    //[DejalBezelActivityView removeViewAnimated:YES];
    [super viewDidAppear:animated];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self performSelector:@selector(displayActivityView) withObject:self.moviePlayer.view afterDelay:0.1];

    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:video.link]];
    [moviePlayer prepareToPlay];

    //[moviePlayer setShouldAutoplay:NO];
    moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
    moviePlayer.scalingMode = MPMovieScalingModeAspectFit;

    if([moviePlayer respondsToSelector:@selector(useApplicationAudioSession)])
    {
        if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
        {
            NSLog(@"iPhone ios5.x");
            [moviePlayer.view setFrame: CGRectMake(0.0f, 0.0f, 480.0f, 320.0f)];
            //moviePlayer.view.transform = CGAffineTransformConcat(moviePlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2));
        }
        else{
            NSLog(@"iPad ios5.x");
            [moviePlayer.view setFrame: CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f)];
            moviePlayer.view.transform = CGAffineTransformConcat(moviePlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2));
            [moviePlayer.view setFrame:[IpadAppDelegate window].bounds];
        }
    }
    else
    {
        if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
        {
            moviePlayer.view.transform = CGAffineTransformConcat(moviePlayer.view.transform, CGAffineTransformMakeRotation(M_PI_2));

            NSLog(@"iPhone ios6.x");
            CGSize result = [[UIScreen mainScreen] bounds].size;
            if(result.height == 480)
            {
                [moviePlayer.view setFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
            }
            if(result.height == 568)
            {
                //moviePlayer.controlStyle = MPMovieControlStyleDefault;
                [moviePlayer.view setFrame:self.view.bounds];
            }
        }
        else{
            NSLog(@"ipad ios 6.x");
            [moviePlayer.view setFrame: CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f)];
            //[moviePlayer.view setFrame:[IpadAppDelegate window].bounds];
        }
    }

    [self.view addSubview:moviePlayer.view];
    [moviePlayer play];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
        return YES;
    return NO;
}

- (BOOL)shouldAutorotate{
    return NO;
}

/*
- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationLandscapeRight;
}
*/

- (IBAction)displayActivityView
{
    [DejalBezelActivityView activityViewForView:self.moviePlayer.view withLabel:@"节目正在下载中,请稍后..."].showNetworkActivityIndicator = NO;
}

- (void)removeActivityView;
{
    [DejalBezelActivityView removeViewAnimated:YES];
    [[self class] cancelPreviousPerformRequestsWithTarget:self];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:41:29+00:00Added an answer on June 16, 2026 at 7:41 am

    This worked for me.

    [self dismissViewControllerAnimated:NO completion:^{
        [self.view removeFromSuperview];
    }];
    

    Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to present a view controller where I have one Background imageView. Alpha
I present a modalViewController that is actually a navigation controller with one view, and
I'm trying to call a function present in one class from another class by
One business jar which have been developed by us is present in war. but
I had read somewhere about one specific feature that is present in awk but
I have created one library project in iphone and my images folder is present
I have one datatable. In that table I have columns named [Total Day], [Present
I have a simple project to present a modal view controller and transfer back
I am trying to modal present a view controller like below: UIStoryboard *storyboard =
Trying to present a modal view controller with the following code MapViewController *mapView =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.