iPhone Simulator Plays Video, Real Device Won'T

Youtube Fails on device, works on Simulator

I'll have to answer my own question. The problem was that I used to show the video inside UITableViewHeader by implementing the needed delegates:

viewForHeaderInSection

heightForHeaderInSection

I have only one section so I returned value there only if section == 0 I do not know what exactly causes this issue, but probably multiple calling of the method leads to this. What I did was to simply move the initialisation of UIWebView inside viewWillAppear and set it as tableViewHeaderView. So I'm now setting it only once and the problem is gone:

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)

dispatch_once(&token) {
self.initHeader()
}
}

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



Related Topics



Leave a reply



Submit