How to add video to iphone simulator

okey, try this:

- (void) downloadVideo {
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://sepwww.stanford.edu/sep/jon/trash/poolwaves.mov"]];

You can change the temp.mov to temp.m4v to save the vid in m4v.

NSString *tempPath = [NSString stringWithFormat:@"%@/temp.mov", NSTemporaryDirectory()];
[imageData writeToFile:tempPath atomically:NO];
UISaveVideoAtPathToSavedPhotosAlbum (tempPath, self, @selector(video:didFinishSavingWithError: contextInfo:), nil);
}


- (void) video: (NSString *) videoPath
didFinishSavingWithError: (NSError *) error
   contextInfo: (void *) contextInfo {
    NSLog(@"Finished saving video with error: %@", error);
}

if you change the url to your moviefile, this should work really well... the movies are saved in this directory: /Library/Application Support/iPhone Simulator/4.3.2/Media/DCIM but you are right, if i copy a file to it, it won't show up in the simulator

greets


I did the same as you do with images, drag dropped the video onto the iOS simulator not just photo's app but any app can be running on it at the time you drag drop.

Step 1: Drag drop.

enter image description here

Step 2: iOS simulator opens up safari to play the video file.

enter image description here

Step 3: Click on the share icon to get the Save Video option in the action's list.

enter image description here

But clicking on Save Video action for so many times nothing happens and nothing gets added to the albums. Any ideas? Even tried copy pasting the video file to the simulator's DCIM path.


Short answer:

  1. Drop your video file into ~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE/ and maybe delete the PhotoData file in Media.

Long Answer:

  1. Make sure your movie file type is supported on the iPhone. I used a .mov
  2. Open the Library. (YourUserName/Library) If you can't find the file, it is hidden. Make it visible or user Terminal.
  3. Navigate to ~/Library/Application Support/iPhone Simulator/ If you have multiple iOS Simulators pick the one your are developing for currently. (I had 5.0, 5.1, 6.0 and 6.1)
  4. Navigate to ~/Library/Application Support/iPhone Simulator/6.1/Media/DCIM/100APPLE/ and drop in your video file. If the 100APPLE directory doesn't exist, create it.
  5. Sometimes you have to delete the PhotoData file in Navigate to ~/Library/Application Support/iPhone Simulator/6.1/Media/ to force the Simulator to recognize the new file since you didn't add it through normal means.

Xcode 4.6.3 and MacOS 10.8.4 fyi. Haven't tried on Xcode 5.


It's very simple you just drag any .MOV file to your simulator. Now it will be opened in Safari browser. At top left corner there is a 'Done' button. You just have to press it after this you can press Share button then just choose the option save video and it's done. Now play it in your app. :)