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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 04-10-2009, 01:56 AM   #1 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Angry GAH!!!

this is probably a really nooby question but i am getting this error: expected identifier or '(' before '{' token

Code:
#import "MPMoviePlayerController.h"


@implementation MPMoviePlayerController
@synthesize contentURL;

{

the error is displayed here

	{
	- (id)initWithContentURL:(NSURL *) Users/PMW/Desktop/HeartMonitor/HeartMonitor.mov

	}	

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}


- (void)drawRect:(CGRect)rect {
    // Drawing code
}


- (void)dealloc {
    [super dealloc];
}
}


@end


how do i fix it?!
wasabeeguy is offline   Reply With Quote
Old 04-10-2009, 04:29 AM   #2 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 14
Default

try this:

Code:
#import "MPMoviePlayerController.h"

@implementation MPMoviePlayerController
@synthesize contentURL;

- (id)initWithContentURL:(NSURL *) url //here you set the name of the parameter that can be passed to the method, you can pass the URL when you call the method
{
    // not sure what Users/PMW/Desktop/HeartMonitor/HeartMonitor.mov was doing here, pass a url when you call the mehod
}	

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}


- (void)drawRect:(CGRect)rect {
    // Drawing code
}


- (void)dealloc {
    [super dealloc];
} //one bracket is enough

@end
But I don't see the point in why you are implementing initWithContentURL in a controller class. Correct me if I'm wrong but normally you would want to do something like
Code:
 [myMoviePlayer initWithContentURL: [NSURL URLWithString @"whatever"] ];

Last edited by Daniel S.; 04-10-2009 at 04:50 AM.
Daniel S. is offline   Reply With Quote
Old 04-10-2009, 02:23 PM   #3 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

ok so i put the new string in and i still have the same error and i have a warning that says @end is missing in implementation context.
wasabeeguy is offline   Reply With Quote
Old 04-10-2009, 03:22 PM   #4 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 14
Default

Could you show some more code? The interface and implementation of your controller. And perhaps a description of what you want to do?
Because I still don't get it
Daniel S. is offline   Reply With Quote
Old 04-10-2009, 04:36 PM   #5 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
Default

Quote:
Originally Posted by wasabeeguy View Post
ok so i put the new string in and i still have the same error and i have a warning that says @end is missing in implementation context.
Quote:
Originally Posted by Daniel S. View Post
Could you show some more code? The interface and implementation of your controller. And perhaps a description of what you want to do?
Because I still don't get it
Pardon the blunt response, but this is the most basic of the basic stuff here -- simple, error-free class building. You really to find a good Objective-C reference and start from Chapter 1.
Kalimba is offline   Reply With Quote
Old 04-11-2009, 12:41 AM   #6 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

Quote:
Originally Posted by Daniel S. View Post
Could you show some more code? The interface and implementation of your controller. And perhaps a description of what you want to do?
Because I still don't get it
im simply trying to put a short movie into the app
wasabeeguy is offline   Reply With Quote
Old 04-11-2009, 02:18 AM   #7 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 14
Default

Quote:
Originally Posted by wasabeeguy View Post
im simply trying to put a short movie into the app
I understood that. But the code I posted (the implementation of the class) should work so I don't understand what you did. Which new string did you put in? And above all where? As far as I see it my code didn't contain any strings

Perhaps you should really start with the basics as Kalimba said.
Daniel S. is offline   Reply With Quote
Old 04-11-2009, 02:19 AM   #8 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

i just want a tutorial on how to put a short movie into an app that isnt confusing!
wasabeeguy is offline   Reply With Quote
Old 04-11-2009, 10:39 AM   #9 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 14
Default

Ok, you play a video like that:

Code:
MPMoviePlayerController *playerController;

playerController = [ [MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[ [NSBundle mainBundle] pathForResource:@"filename" ofType:@"mov"]]];
playerController.movieControlMode = MPMovieControlModeVolumeOnly; //whatever you want here; look in the documentation

[playerController play];
remember to import the MPMoviePlayerController.h header file of the MediaPlayer framework.
Daniel S. is offline   Reply With Quote
Old 04-11-2009, 11:20 AM   #10 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

Oh! i had everything right before but the header import!
wasabeeguy is offline   Reply With Quote
Old 04-11-2009, 11:24 AM   #11 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

Ok, i got everything to work except the movie doesnt load but it shows the quicktime symbol and thats it (works for m4v but its low quality)

Last edited by wasabeeguy; 04-11-2009 at 12:26 PM.
wasabeeguy is offline   Reply With Quote
Old 04-11-2009, 01:33 PM   #12 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 14
Default

There are several restrictions about which mov files can be played. You might want to take a look at the documentation. Does the video you want to play play on an iPod?
Daniel S. is offline   Reply With Quote
Old 04-11-2009, 01:41 PM   #13 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

Quote:
Originally Posted by Daniel S. View Post
There are several restrictions about which mov files can be played. You might want to take a look at the documentation. Does the video you want to play play on an iPod?
No, because the format isnt supported
wasabeeguy is offline   Reply With Quote
Old 04-11-2009, 03:35 PM   #14 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
Default

Quote:
Originally Posted by wasabeeguy View Post
No, because the format isnt supported
Well, that answers your question of why it doesn't play in your app, doesn't it?

joe
FlyingDiver is offline   Reply With Quote
Old 04-12-2009, 05:18 PM   #15 (permalink)
Registered Member
 
wasabeeguy's Avatar
 
Join Date: Mar 2009
Location: Phoenix
Posts: 45
Default

Quote:
Originally Posted by FlyingDiver View Post
Well, that answers your question of why it doesn't play in your app, doesn't it?

joe
In the documentation it says the .mov is supported. I want it in that format because its higher quality and less in memory.
wasabeeguy is offline   Reply With Quote
Old 04-14-2009, 02:49 AM   #16 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 14
Default

Take a look at the apple website about the supported video formats:

Quote:
H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
Daniel S. is offline   Reply With Quote
Reply

Bookmarks

Tags
3.0, app, code, iphone

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: 276
22 members and 254 guests
2WeeksToGo, ADY, apatsufas, ckgni, dacapo, Dani77, Fritzer, ghost, HDshot, headkaze, jakerocheleau, joeallenpro, masc2279, mer10, MozyMac, mystic.purple, objch, Rudy, tathaastu, themathminister, timle8n1, Zool
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,878
Threads: 89,223
Posts: 380,731
Top Poster: BrianSlick (7,129)
Welcome to our newest member, olga2000
Powered by vBadvanced CMPS v3.1.0

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