Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-29-2011, 01:57 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 10
Travrew is on a distinguished road
Question Playing a video on startup of app without controls?

I want to make an app that simply plays a video on startup of an application, but doesn't show all the controls, even if the screen is tapped. I would do this myself, but I have no idea how to write the codes and stuff. Could someone please write the code for me and post it here? Also, could you tell me where to paste the code in the SDK? Thanks, I hope I haven't tainted you with my newbity.
Travrew is offline   Reply With Quote
Old 10-29-2011, 09:51 AM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Quote:
Originally Posted by Travrew View Post
I want to make an app that simply plays a video on startup of an application, but doesn't show all the controls, even if the screen is tapped. I would do this myself, but I have no idea how to write the codes and stuff. Could someone please write the code for me and post it here? Also, could you tell me where to paste the code in the SDK? Thanks, I hope I haven't tainted you with my newbity.
Copying and pasting code is not the way to learn, or to write an application. I'd look into using the MPMoviePlayerController class.
Speed is offline   Reply With Quote
Old 10-29-2011, 11:16 AM   #3 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Travrew View Post
I want to make an app that simply plays a video on startup of an application, but doesn't show all the controls, even if the screen is tapped. I would do this myself, but I have no idea how to write the codes and stuff. Could someone please write the code for me and post it here? Also, could you tell me where to paste the code in the SDK? Thanks, I hope I haven't tainted you with my newbity.
I figured out how to make our app play a full-screen video without controls, and dismiss the video when you tap the screen. It was kinda tricky.

No, I'm not going to post the code and tell you where to paste it in. It's not that simple. Your question is the equivalent of asking somebody to explain where to cut in order to perform an appendectomy.

You'd need to figure out how to adapt it to your needs. It would involve adding frameworks to your app, including headers, adding protocols, and various other things. Based on the level of questions you're asking, you would have no idea how to do those things, and would make helping you extremely painful.

You either need to learn the fundamentals enough to understand the steps involved, or hire somebody to do it for you.

If you would like to hire our company we can add these features to your app. I'm sure there are others on this forum who are also available for hire.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 10-29-2011, 01:15 PM   #4 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 10
Travrew is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
You'd need to figure out how to adapt it to your needs. It would involve adding frameworks to your app, including headers, adding protocols, and various other things. Based on the level of questions you're asking, you would have no idea how to do those things, and would make helping you extremely painful.
The app I'm trying to make won't have any other features other than playing a video, and I don't want it to dismiss when tapped. Could you please just post the code here, and I'll just figure out the rest? I promise I won't cause you any pain.
Travrew is offline   Reply With Quote
Old 10-29-2011, 03:00 PM   #5 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Travrew View Post
The app I'm trying to make won't have any other features other than playing a video, and I don't want it to dismiss when tapped. Could you please just post the code here, and I'll just figure out the rest? I promise I won't cause you any pain.
It's about 40 lines of code. If you are not an experienced iOS developer I doubt it will be very useful to you. I'm providing the code below "as is". I'll answer questions about it and help you get it working in your program - if you hire me by the hour to do so.

Sorry if that seems harsh, but I sense that otherwise this could involve dozens of questions and answers, and I'm not signing up for that.

Code:
- (IBAction) videoAction:(id)sender
{
  if (myMovie)
    return ;
  
  NSString* a_path = [[NSBundle mainBundle] pathForResource:@"kevin-kell-introduction" ofType: @"mp4"];
  
  if (a_path==nil)
    return ;
  
  NSURL* a_url = [NSURL fileURLWithPath:a_path];
  
  if (a_url==nil)
    return ;
  
  Class moviePlayerViewControllerClass = (NSClassFromString(@"MPMoviePlayerViewController"));
  newStyleVideoPlayer = moviePlayerViewControllerClass && [MPMoviePlayerViewController instancesRespondToSelector: @selector(presentMoviePlayerViewControllerAnimated:)];
  if (newStyleVideoPlayer)
  {
    //We're running in iOS 3.2 or later, so use the new MPMoviePlayerViewController class.
    
    MPMoviePlayerViewController* movie_controller = [[[MPMoviePlayerViewController alloc] initWithContentURL:a_url] autorelease];
    
    if (movie_controller) {
      self.myMovie = movie_controller;
      
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playBackFinished:) name:@"MPMoviePlayerPlaybackDidFinishNotification" object:nil];
      
      MPMoviePlayerController* theMoviewPlayer = movie_controller.moviePlayer;
      theMoviewPlayer.controlStyle = MPMovieControlStyleNone;
      //theMoviewPlayer.fullscreen = TRUE;
      
      [[UIApplication sharedApplication] setStatusBarHidden: TRUE withAnimation: UIStatusBarAnimationNone];
      [self presentMoviePlayerViewControllerAnimated: (MPMoviePlayerViewController*)self.myMovie];
    }
  }
}
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 10-30-2011, 01:10 AM   #6 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 10
Travrew is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
It's about 40 lines of code. If you are not an experienced iOS developer I doubt it will be very useful to you. I'm providing the code below "as is". I'll answer questions about it and help you get it working in your program - if you hire me by the hour to do so.

Sorry if that seems harsh, but I sense that otherwise this could involve dozens of questions and answers, and I'm not signing up for that.

Code:
- (IBAction) videoAction:(id)sender
{
  if (myMovie)
    return ;
  
  NSString* a_path = [[NSBundle mainBundle] pathForResource:@"kevin-kell-introduction" ofType: @"mp4"];
  
  if (a_path==nil)
    return ;
  
  NSURL* a_url = [NSURL fileURLWithPath:a_path];
  
  if (a_url==nil)
    return ;
  
  Class moviePlayerViewControllerClass = (NSClassFromString(@"MPMoviePlayerViewController"));
  newStyleVideoPlayer = moviePlayerViewControllerClass && [MPMoviePlayerViewController instancesRespondToSelector: @selector(presentMoviePlayerViewControllerAnimated:)];
  if (newStyleVideoPlayer)
  {
    //We're running in iOS 3.2 or later, so use the new MPMoviePlayerViewController class.
    
    MPMoviePlayerViewController* movie_controller = [[[MPMoviePlayerViewController alloc] initWithContentURL:a_url] autorelease];
    
    if (movie_controller) {
      self.myMovie = movie_controller;
      
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playBackFinished:) name:@"MPMoviePlayerPlaybackDidFinishNotification" object:nil];
      
      MPMoviePlayerController* theMoviewPlayer = movie_controller.moviePlayer;
      theMoviewPlayer.controlStyle = MPMovieControlStyleNone;
      //theMoviewPlayer.fullscreen = TRUE;
      
      [[UIApplication sharedApplication] setStatusBarHidden: TRUE withAnimation: UIStatusBarAnimationNone];
      [self presentMoviePlayerViewControllerAnimated: (MPMoviePlayerViewController*)self.myMovie];
    }
  }
}
Thank you so much, I finally got it to work!
Travrew is offline   Reply With Quote
Old 10-30-2011, 01:49 AM   #7 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

You're too nice Duncan. I doubt he'll actually learn anything from this and now he has it in his head that he can get free code.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 10-30-2011, 02:45 AM   #8 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 10
Travrew is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
You're too nice Duncan. I doubt he'll actually learn anything from this and now he has it in his head that he can get free code.
I have no evident future in coding, so there's no need to do any learning. Also, this is my first and last iPhone SDK project, so don't worry about me running around asking for free code. So, I suppose this is my last post on this forum. I hope you all don't miss me and my 4 posts.
Travrew is offline   Reply With Quote
Old 10-30-2011, 07:57 AM   #9 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Domele View Post
You're too nice Duncan. I doubt he'll actually learn anything from this and now he has it in his head that he can get free code.
I started to refuse, and then thought "what the heck". Maybe he can figure out enough to make it work. It sounds like he did. That's a good sign.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Reply

Bookmarks

Tags
controls, play, startup, video

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 399
13 members and 386 guests
13dario13, 7twenty7, buggen, EvilElf, glenn_sayers, j.b.rajesh@gmail.com, LunarMoon, morterbaher, QuantumDoja, sacha1996, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:30 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0