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 6728569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:11:11+00:00 2026-05-26T10:11:11+00:00

My Video works when I click my play button, and I know the code

  • 0

My Video works when I click my play button, and I know the code for my view change works. I just can’t seem to get the view to change after my video is done playing, not sure what is going wrong. Any ideas to get the view to change once the video is done playing?

My code to play movie

-(IBAction)playMovie:(id)sender {
NSString *movieUrl = [[NSBundle mainBundle] pathForResource:@"Movie_1666" ofType:@"m4v"]; 
playerController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:movieUrl]];
//Smoothe Transition
//[self presentMoviePlayerViewControllerAnimated:playerController];
//Instant Transistion
[self presentModalViewController:playerController animated:NO];
playerController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
playerController.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
playerController.moviePlayer.controlStyle = MPMovieControlStyleNone;
[playerController.moviePlayer play];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerController]; }

My method to change views

- (void)playbackFinished:(NSNotification*) notification {
MPMoviePlayerController *playerController = [notification object];
[[NSNotificationCenter defaultCenter] 
 removeObserver:self
 name:MPMoviePlayerPlaybackDidFinishNotification
 object:playerController];

View2 *view2 = [[View2 alloc] initWithNibName:@"View2" bundle:nil];
View2.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:view2 animated:YES]; }

EDIT:
My Notification object was wrong and wasn’t triggering my playbackFinished method
this change fixes that.

- (void)playbackFinished:(NSNotification*) notification {
playerController = [notification object];
[[NSNotificationCenter defaultCenter] 
 removeObserver:self
 name:MPMoviePlayerPlaybackDidFinishNotification
 object:playerController];

I also put this in my header file to make it global for use in my playbackFinished method

MPMoviePlayerViewController *playerController;
  • 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-05-26T10:11:12+00:00Added an answer on May 26, 2026 at 10:11 am

    Once the movie play finished, dismiss the playerController view without animation. Also check, whether you are presenting the View2 in main thread.

    Edit:
    Dismiss the playerController by

    [playerController dismissModalViewControllerAnimated:NO];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've a simple list of play button, such as <a class=play rel=video-1></a> <a class=play
I have some code that works fine to show YouTube Video. What I want
Hi all I video playing using the FLVPlayback component. I know I can use
I'm trying to open video player in windows 7 with PHP but can't seem
I want to create java program that can pause / play the vlc video
How can I get my video player to skip/seek to a certain time. I
I'm trying the following code http://code.google.com/apis/ajax/playground/#change_the_playing_video It works well when runned from the playground
I am using standard 3G connection for video streaming. Streaming Media application works fine.
I tried to replace my Flash video with a jQuery cycle. The cycle works,
I would like to insert a youtube video and play it right away, I

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.