1

I've been trying adding movie clip to the project but it just doesn't work. I've made sure that the *.mov file exists in the file directory.

But if I try to add the inception clip at movieNamed:@"blahblah.mov", it works perfectly.

Not sure if the problem is in the code or the movie clips I'm trying to use is not valid(file are not too big or anything).

Can possibly explain the problem?

Here's the code

#import "C4WorkSpace.h"

C4Movie *movie;

@implementation C4WorkSpace

-(void)setup {
    movie = [C4Movie movieNamed:@"thinkdifferent.mov"];
    movie.width = self.canvas.width;
    CGPoint centerOfScreen = CGPointMake(self.canvas.width/2, self.canvas.height/2);
    movie.center = centerOfScreen;
    [self.canvas addMovie:movie];
}

@end

Here's an image of the code environment with the error:

enter image description here

And the direct link to the image: Error Image

C4 - Travis
  • 4,502
  • 4
  • 31
  • 56
lostinwent
  • 11
  • 1

1 Answers1

1

I've had a look at the link you sent me, and have found that there are a couple of different ways that things might be going wrong for you.

First, I had to download the movie from that link... BUT, when I did this in Safari there was a problem with it, as follows:

  1. Safari downloaded the link as an mov file
  2. The file was 433kb... pretty small
  3. This led me to believe that what Safari was downloading was actually a .mov container
  4. Tried to dig through the site's code using the Safari Developer extensions
  5. Could only ever download the .mov container from Safari

What I'd downloaded was actually a container and NOT the actual source movie and this never worked in C4 because it was always only a reference to a movie and not an object itself.

So, I took a crack at it with Chrome's developer tools and was able to save the file as source.

  1. From Chrome, the file saved as an mp4 at 75.6MB
  2. Tried loading the file directly into a C4 project and it worked.

The following code works for me:

#import "C4WorkSpace.h"

@implementation C4WorkSpace {
    C4Movie *m;
}

-(void)touchesBegan {
    if(m == nil) {
        m = [C4Movie movieNamed:@"iPhone.mp4"];
        m.shouldAutoplay = YES;
       [self.canvas addMovie:m];
     }
}

@end 

I delayed the starting of the movie because it's a big file. You don't actually want to have a bunch of files this large just sitting directly in your project, but for testing it worked. I start creating the movie in touchesBegan so that the app doesn't get bogged down in loading the movie as the app is opening up.


Ok, this might not actually solve your problem. So, I tested creating a small clip from the big movie source file with the following steps:

  1. Open the movie in Quicktime
  2. Trim the movie to a 12 second clip (start the trim job by hitting cmd+t)
  3. Export the trimmed movie (cmd+shift+s, or File > Export)
  4. Choose iPad, iPhone 4, Apple TV option
  5. Export the m4v
  6. Drag it into the my original project, rename the variable to match the new file
  7. It works!

So, my suspicion is that the first part of this answer might be where you're hung up. The file not actually being a movie file but a pointer to some other media. The reason I thought of this is because I remembered that when I export a Quicktime mov for web it actually creates a folder of media with an .mov file that references some other media in another folder.

C4 - Travis
  • 4,502
  • 4
  • 31
  • 56