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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:44:57+00:00 2026-05-24T19:44:57+00:00

Hi i am designing a basic iPhone/iPad app that has a UINavigationController. The user

  • 0

Hi i am designing a basic iPhone/iPad app that has a UINavigationController. The user clicks on the table row and it opens up a video in full screen. This works well and plays the video. however when you click on the navigation bar to go back to the table on the rootViewController the video keeps playing the audio in the background. Any ideas?

    //  RevoLix_HDAppDelegate.h
//  RevoLix HD
//
//  Created by Rob Hartley on 8/6/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
@class UrologyViewController;

@interface RevoLix_HDAppDelegate : NSObject <UIApplicationDelegate> {

    UrologyViewController *urologyViewController;

}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end




RevoLix_HDAppDelegate.m
//  RevoLix HD
//
//  Created by Rob Hartley on 8/6/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "RevoLix_HDAppDelegate.h"
#import "PlayerViewController.h"
#import "UrologyViewController.h"

@implementation RevoLix_HDAppDelegate


@synthesize window=_window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    //PlayerViewController *vc = [[PlayerViewController alloc] init];
    //[[self window]setRootViewController:vc];

    urologyViewController = [[UrologyViewController alloc] init];

    //create an instance of a UINavigationController, its stack contains only itemsViewController

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:urologyViewController];
    [urologyViewController release];


    [[self window]setRootViewController:navController];

    [navController release];

    [_window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     */
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    /*
     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     */
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    /*
     Called when the application is about to terminate.
     Save data if appropriate.
     See also applicationDidEnterBackground:.




 UrologyViewController.h
//  RevoLix HD
//
//  Created by Rob Hartley on 8/7/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "PlayerViewController.h"
@ class PlayerViewController;



@interface UrologyViewController : UITableViewController {

    NSMutableArray *allVideos;


}


@end



 UrologyViewController.m
//  RevoLix HD
//
//  Created by Rob Hartley on 8/7/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "UrologyViewController.h"
#import "UrologyVideos.h"
#import "PlayerViewController.h"


@implementation UrologyViewController


- (id)init
{
    self = [super initWithStyle:UITableViewStyleGrouped];

    if (self) {
        [[self navigationItem] setTitle:@"Urology"];
    }

    allVideos = [[NSMutableArray alloc] init];

        [allVideos addObject:[UrologyVideos fieldVideo]];
    [allVideos addObject:[UrologyVideos strictureVideo]];




    return self;
}

/*- (id)initWithStyle:(UITableViewStyle)style
{
    return [self init];
}*/




- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    int numberOfRows = [allVideos count];

    return numberOfRows;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //create an instance of UITableViewCell, with default appearance

    UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"] autorelease];

    //set the text on the cell with the title of the video that is at the nth idex of possessions, where n = row this cell will appear in on the tableview


    [[cell textLabel] setText:[[allVideos objectAtIndex:[indexPath row]] videoTitle]];

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    PlayerViewController *playerViewController = [[[PlayerViewController alloc] init] autorelease];

    // Give detail view controller a pointer to the possession object in this row
    [playerViewController  setSelectVideo:[allVideos objectAtIndex:[indexPath row]]];

    // Push it onto the top of the navigation controller's stack
    [[self navigationController] pushViewController:playerViewController 
                                           animated:YES];

}




- (void)viewDidUnload
{

    [super viewDidUnload];
}

-(void)dealloc
{

    [allVideos release];

    [super dealloc];
}

@end



#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@class UrologyVideos;


@interface PlayerViewController : UIViewController {

    MPMoviePlayerViewController *moviePlayer;

    UrologyVideos *selectVideo;

}

@property (nonatomic,retain) UrologyVideos *selectVideo;


@end




PlayerViewController.m
//  RevoLix HD
//
//  Created by Rob Hartley on 8/6/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "PlayerViewController.h"
#import "UrologyVideos.h"


@implementation PlayerViewController
@synthesize selectVideo;

- (id)init
{
    return [super initWithNibName:@"PlayerViewController" bundle:nil];


}

- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle
{
    return [self init];
}



- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [[self navigationItem] setTitle:[selectVideo videoTitle]];

}


- (void) viewWillDisappear:(BOOL)animated   
{
    [super viewWillDisappear:animated];


}


- (void)viewDidLoad
{
        [super viewDidLoad];

      NSString *moviePath = [[NSBundle mainBundle] pathForResource:[selectVideo videoFileName] ofType:@"m4v"];
     NSURL *movieURL = [NSURL fileURLWithPath:moviePath];

    moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];

    [[self view] addSubview:[moviePlayer view]];
    float halfHeight = [[self view]bounds].size.height;
    float width = [[self view] bounds].size.width;
    [[moviePlayer view] setFrame:CGRectMake(0, 0, width, halfHeight)];


}



- (void)dealloc
{
    [selectVideo release];
    [moviePlayer release];
    [MPMoviePlayerViewController release];

    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidUnload
{
    [super viewDidUnload];

    [selectVideo release];
    selectVideo = nil;
    [moviePlayer release];
    moviePlayer = nil;
    [MPMoviePlayerViewController release];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

@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-05-24T19:44:59+00:00Added an answer on May 24, 2026 at 7:44 pm

    Apple explains that video playback may be set to use “your application’s audio session by default, but can be configured to use a system-supplied audio session.”

    If you check the audio documentation, you will find you can setup behavior to stop or keep playing music if application goes to background (typically, to obtain the iPod player behavior). That’s where you should set the proper application variable.

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

Sidebar

Related Questions

I am designing a GUI that has the following basic idea (similarly modeled after
While designing a table my colleague here says that I should avoid identity column
When designing user table what would be the must have fields from the security/user
I’m in the process of designing an iPhone app, using Core Data for data
Rather than use a full-blown PHP MVC, I'm designing one that will best-fit my
Q1) I am designing a iPhone app and want to know on what basis
I'm currently designing a restaurant based menu system of iPad with the basic functionality
I'm designing a basic Sencha Touch app in order to get familiar with the
Designing forms has always been fun, but getting them to send email on the
When designing a lookup table (enum) in SqlServer 2005, if you know the number

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.