Search Results

Search found 37 results on 2 pages for 'movieplayer'.

Page 1/2 | 1 2  | Next Page >

  • How does overlayViewTouched notification work in the MoviePlayer sample code

    - by Jonathan
    Hi, I have a question regarding the MoviePlayer sample code provided by apple. I don't understand how the overlayViewTouch notification works. The NSlog message I added to it does not get sent when I touch the view (not button). // post the "overlayViewTouch" notification and will send // the overlayViewTouches: message - (void)overlayViewTouches:(NSNotification *)notification { NSLog(@"overlay view touched"); // Handle touches to the overlay view (MyOverlayView) here... } I can, however, get the NSlog notification if I place it in -(void)touchesBegan in "MyOverlayView.m". Which makes me think it is recognizing touches but not sending a notification. // Handle any touches to the overlay view - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; if (touch.phase == UITouchPhaseBegan) { NSLog(@"overlay touched(from touchesBegan") // IMPORTANT: // Touches to the overlay view are being handled using // two different techniques as described here: // // 1. Touches to the overlay view (not in the button) // // On touches to the view we will post a notification // "overlayViewTouch". MyMovieViewController is registered // as an observer for this notification, and the // overlayViewTouches: method in MyMovieViewController // will be called. // // 2. Touches to the button // // Touches to the button in this same view will // trigger the MyMovieViewController overlayViewButtonPress: // action method instead. NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc postNotificationName:OverlayViewTouchNotification object:nil]; } } Can anyone shed light on what I am missing or doing wrong? Thank you.

    Read the article

  • Youtube video embed in WebView and MoviePlayer control

    - by Tronic
    hi, i embed a youtube video into a webview. the problem is: when i pop the current view (which includes the webview) from navigation controller, the the movie itself stops, but the audio is continues running. when i push the view controller on the navigation controller again, i can play the movie newly, but the old audio is still there. my webview code ids_ = [NSArray arrayWithObjects:@"2b84g38Z_60",@"3URx0tM-rMc",@"HZpi-2HVhq0",@"Hhns0DRPI44",@"hRuoxRQ4Q3k",@"lkMXwNBGRA8",@"tXGc6wWIFJo",@"uzGdEn8aW-Q",@"ZAoEBdt8C5M",@"vn8EJqt2BvQ",@"7Z_qRbjG6Ck",@"JspRcxGUijs"@"lM2lcVOh5YU",@"2b84g38Z_60",nil]; int numIds_ = [ids_ count]; NSLog(@"%d", arc4random()%numIds_); NSString *youTubeVideoHTML = [[NSString alloc] initWithFormat:@"<html><head></head><body style=\"margin:0;background-color:#000;\"><iframe class=\"youtube-player\" type=\"text/html\" width=\"640\" height=\"365\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\"></iframe></body></html>", [ids_ objectAtIndex:arc4random()%numIds_]]; NSLog(youTubeVideoHTML); [youtubeView loadHTMLString:youTubeVideoHTML baseURL:nil]; thanks in advance

    Read the article

  • EXC_BAD_ACCESS when I change moviePlayer contentURL

    - by Bruno
    Hello, In few words, my application is doing that : 1) My main view (MovieListController) has some video thumbnails and when I tap on one, it displays the moviePlayer (MoviePlayerViewController) : MovieListController.h : @interface MoviePlayerViewController : UIViewController <UITableViewDelegate>{ UIView *viewForMovie; MPMoviePlayerController *player; } @property (nonatomic, retain) IBOutlet UIView *viewForMovie; @property (nonatomic, retain) MPMoviePlayerController *player; - (NSURL *)movieURL; @end MovieListController.m : MoviePlayerViewController *controllerTV = [[MoviePlayerViewController alloc] initWithNibName:@"MoviePlayerViewController" bundle:nil]; controllerTV.delegate = self; controllerTV.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController: controllerTV animated: YES]; [controllerTV release]; 2) In my moviePlayer, I initialize the video I want to play MoviePlayerViewController.m : @implementation MoviePlayerViewController @synthesize player; @synthesize viewForMovie; - (void)viewDidLoad { NSLog(@"start"); [super viewDidLoad]; self.player = [[MPMoviePlayerController alloc] init]; self.player.view.frame = self.viewForMovie.bounds; self.player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.viewForMovie addSubview:player.view]; self.player.contentURL = [self movieURL]; } - (void)dealloc { NSLog(@"dealloc TV"); [player release]; [viewForMovie release]; [super dealloc]; } -(NSURL *)movieURL { NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"FR_Tribord_Surf camp_100204" ofType:@"mp4"]; if (moviePath) { return [NSURL fileURLWithPath:moviePath]; } else { return nil; } } - It's working good, my movie is display My problem : When I go back to my main view : - (void) returnToMap: (MoviePlayerViewController *) controller { [self dismissModalViewControllerAnimated: YES]; } And I tap in a thumbnail to display again the moviePlayer (MoviePlayerViewController), I get a *Program received signal: “EXC_BAD_ACCESS”.* In my debugger I saw that it's stopping on the thread "main" : // // main.m // MoviePlayer // // Created by Eric Freeman on 3/27/10. // Copyright Apple Inc 2010. All rights reserved. // #import <UIKit/UIKit.h> int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); //EXC_BAD_ACCESS [pool release]; return retVal; } If I comment self.player.contentURL = [self movieURL]; it's working, but when I let it, iI have this problem. I read that it's due to null pointer or memory problem but I don't understand why it's working the first time and not the second time. I release my object in dealloc method. Thanks for your help ! Bruno.

    Read the article

  • Movie colors are off on ubuntu using Movieplayer?

    - by chris
    I've been playing with a new SLR that also happens to record movies. When I try to view a movie using Movie Player, it plays fine, and the sound is there, but the colors are off - green grass is purple, and my golden retriever is a blue retriever. VLC reports that the file is broken, offers to repair it, and plays it with the same problem. The same file plays fine under WinXP with both Media Player and Quicktime, and with no problems under MacOS also with Quicktime. What's the problem, and how can I fix it?

    Read the article

  • Portrait video to landscape

    - by dappa
    I am aware questions like this one may already be out there but for the sake of others like me I will go ahead and ask I have a app that is set to only allow portrait orientation but this setting affects my videos as I would like only the videos to be able to play in landscape also. Is there a method I can add unto my .m file to make this work? Here is my code; #import "BIDVideosViewController.h" @interface BIDVideosViewController () @end @implementation BIDVideosViewController @synthesize moviePlayer ; @synthesize tableList; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; UITableView *table = [[UITableView alloc]initWithFrame:self.view.bounds]; [table setDelegate:self]; [table setDataSource:self]; [self.view addSubview:table]; tableList = [[NSMutableArray alloc] initWithObjects:@"Gangan",@"SwimGood",@"German Ice", nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [tableList count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *DisclosureButtonIdentifier = @"DisclosurebutotonIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DisclosureButtonIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DisclosureButtonIdentifier]; } NSInteger row = [indexPath row]; NSString *rowString = [tableList objectAtIndex:row]; cell.textLabel.text = rowString; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { { NSBundle *str = [tableList objectAtIndex:indexPath.row]; if ([str isEqual:@"Gangan"]) { NSBundle *bundle = [NSBundle mainBundle]; NSString *thePath = [bundle pathForResource:@"Gangan" ofType:@"mp4"]; NSURL *theurl = [NSURL fileURLWithPath:thePath]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES]; [moviePlayer play]; } else if ([str isEqual:@"SwimGood"]) { NSBundle *bundle = [NSBundle mainBundle]; NSString *thePath = [bundle pathForResource:@"SwimGood" ofType:@"mp4"]; NSURL *theurl = [NSURL fileURLWithPath:thePath]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES]; [moviePlayer play]; } else if ([str isEqual:@"German Ice"]) { NSBundle *bundle = [NSBundle mainBundle]; NSString *thePath = [bundle pathForResource:@"German Ice" ofType:@"mp4"]; NSURL *theurl = [NSURL fileURLWithPath:thePath]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES]; [moviePlayer play]; } } } @end

    Read the article

  • Video loads but doesn't play with MPMoviePlayerController in iPad

    - by hgpc
    I'm using MPMoviePlayerController to play videos in an iPad app. Everything works well on the iPad simulator. On an actual device, the videos load but don't play, even if I press the play button. I can move the slider and see different frames of the video, but it never plays. I'm using the following code: moviePlayer = [[MPMoviePlayerController alloc] init]; moviePlayer.shouldAutoplay = YES; moviePlayer.contentURL = video.urlVideo; moviePlayer.view.frame = videoPlayerContainer.bounds; moviePlayer.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [videoPlayerContainer addSubview:moviePlayer.view]; moviePlayer.controlStyle = MPMovieControlStyleEmbedded; [moviePlayer play]; Help?

    Read the article

  • How can I launch QuickTime from my app?

    - by Sheehan Alam
    I am trying to load a video from the web, but am having trouble getting it to appear in QuickTime. I can only hear the audio. I would like it to launch QuickTime. - (void)loadView { NSURL *movieURL = [NSURL URLWithString:@"http://movies.apple.com/media/us/mac/getamac/2009/apple-mvp-biohazard_suit-us-20090419_480x272.mov"]; if (movieURL != nil) { moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; moviePlayer.initialPlaybackTime = -1.0; // Register to receive a notification when the movie has finished playing. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerScalingModeDidChangeNotification object:moviePlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endPlay:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; moviePlayer.scalingMode = MPMovieScalingModeAspectFit; moviePlayer.movieControlMode = MPMovieControlModeDefault; moviePlayer.backgroundColor = [UIColor blackColor]; [moviePlayer play]; } }

    Read the article

  • Why won't my movie play using MPMoviePlayerController?

    - by Nosrettap
    I'm trying to get a basic movie to play in an iPhone app; however, I can't seem to get it to work. Here's my entire code: #import <MediaPlayer/MediaPlayer.h> #import "ViewController.h" @implementation ViewController - (IBAction)playMoviePressed:(id)sender { NSURL *url = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; moviePlayer.controlStyle = MPMovieControlStyleDefault; moviePlayer.shouldAutoplay = YES; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES]; [moviePlayer prepareToPlay]; [moviePlayer play]; } @end I have one button on screen that calls playMoviePressed when it is tapped. I know that this method is getting called. I have also tried this with .mov and .mp4 local files that I have dragged into xcode.

    Read the article

  • how do i call mpmovieplayer from applicationwillresignactive in ppdelegate

    - by ss30
    i'm using mpmovieplayer to play audio stream, one problem i'm having trouble with handling intruptions e.g when call is received. My player is declared in viewcontroller and i beleive i need to do something in applicationdidresignactive in my appdelegate right? how do i do that if my appdelegate isn't aware of my moviePlayer? i'm new to iphone dev so i'm learning as i go and enjoying it :) here is what i'm doing in viewcontroller -(IBAction)play1MButton:(id)sender{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerStatus:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil]; NSString *url = @"http://22.22.22.22:8000/listen.pls"; [self.activityIndicator startAnimating]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]]; [moviePlayer prepareToPlay]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerLoadStateChanged:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil]; } } -(void) moviePlayerStatus:(NSNotification*)notification { //MPMoviePlayerController *moviePlayer = notification.object; MPMoviePlaybackState playbackState = moviePlayer.playbackState; if(playbackState == MPMoviePlaybackStateStopped) { NSLog(@"MPMoviePlaybackStateStopped"); } else if(playbackState == MPMoviePlaybackStatePlaying) { NSLog(@"MPMoviePlaybackStatePlaying"); } else if(playbackState == MPMoviePlaybackStatePaused) { NSLog(@"MPMoviePlaybackStatePaused"); } else if(playbackState == MPMoviePlaybackStateInterrupted) { NSLog(@"MPMoviePlaybackStateInterrupted"); } else if(playbackState == MPMoviePlaybackStateSeekingForward) { NSLog(@"MPMoviePlaybackStateSeekingForward"); } else if(playbackState == MPMoviePlaybackStateSeekingBackward) { NSLog(@"MPMoviePlaybackStateSeekingBackward"); } } - (void) moviePlayerLoadStateChanged:(NSNotification*)notification { if ([moviePlayer loadState] != MPMovieLoadStateUnknown) { [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerLoadStateDidChangeNotification object:moviePlayer]; [moviePlayer play]; [self.activityIndicator stopAnimating]; [moviePlayer setFullscreen:NO animated:NO]; } } and in appdelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; NSError *setCategoryError = nil; [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError]; if (setCategoryError) { } NSError *activationError = nil; [audioSession setActive:YES error:&activationError]; if (activationError) { } I can catch the errors but how do i use the player from appdelegate?!! thanks in advance

    Read the article

  • MPMoviePlayerController not setting the bounds for background image

    - by VXtreme
    I am using MPMoviePlayerController for playing the media . I want to set the image at the background of the player.The image is set accordingly but when i set the bounds for the image then the image is not set according to bounds . I have tried following code: UIImageView *imageView=[[UIImageView alloc]initWithImage:[operationControl getCoverImage:stringId]]; imageView.bounds=CGRectMake(0, 100, 200, 200); [moviePlayer.backgroundView addSubview:imageView]; [moviePlayer.backgroundView setBackgroundColor:[UIColor purpleColor]]; moviePlayer.controlStyle = MPMovieControlStyleDefault; moviePlayer.shouldAutoplay = YES; [moviePlayer setScalingMode:MPMovieScalingModeAspectFit]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES];

    Read the article

  • Looking for a component (.NET or COM/ActiveX) that can play AVI files in a WinForms app

    - by MusiGenesis
    I'm looking for something like the Windows Media Player control that can be hosted on a form. The WMP doesn't work for me because I need a control that can play a continuously-appended playlist of AVI files in sequence, so that the transition from one file to the next happens seamlessly (i.e. without any glitches or pauses in the video and audio). With WMP, there's always a delay between files of half a second or so. Does anyone know of a control (it can be either commercial or open-source) that can do this? I assume anything like this wraps DirectX, and that's OK too.

    Read the article

  • Why is no video showing using MPMoviePlayerController

    - by nathanjosiah
    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://feeds.harvest.org/~r/greglaurietv/~5/MW4zfyeubC8/HD100307-iPod.mp4"]]; moviePlayer.scalingMode = MPMovieScalingModeNone; moviePlayer.controlStyle = MPMovieControlStyleDefault; [moviePlayer play]; only audio is playing, but nothing shows up in my view.... what am i doing wrong?

    Read the article

  • How to release MPMoviePlayerController?

    - by 4thSpace
    I have a couple of views that access the movie player. I've put the following code in a method in AppDelegate for these views. They send in the filename to play. The code works fine but I know a release is required somewhere. If I add the last line as a release or autorelease, the app will crash once the user presses done on the movieplayer. MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]]; moviePlayer.movieControlMode = MPMovieControlModeDefault; [moviePlayer play]; //[moviePlayer release]; I get this error: objc[51051]: FREED(id): message videoViewController sent to freed object=0x1069b30 Program received signal: “EXC_BAD_INSTRUCTION”. How should I be releasing the player?

    Read the article

  • Cocoa touch SDK 3.2 - How to play video

    - by teepusink
    Hi, How do I play video on SDK 3.2 (iPad)? Read many questions here but they talked mostly for iPhone. For example, the MoviePlayer example here http://developer.apple.com/iphone/library/samplecode/MoviePlayer_iPhone/Introduction/Intro.html That works on 3.1.3 but when I run it on 3.2, it doesn't work. So basically I'm able to play a video on 3.1.3 using this code but the same code won't run on 3.2 NSString *moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.mp4"]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]]; moviePlayer.movieControlMode = MPMovieControlModeDefault; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; [moviePlayer play]; Thanks, Tee

    Read the article

  • iPhone universal app. MoviePlayer.framwork problem.

    - by e40pud
    I have application based on 3.0 iPhone OS SDK One of tasks is playing video (I use MPMoviePlayerController for this task) Now I try to make universal app working on both 3.0 and 3.2 OS I did all steps described in apple documentation: Upgrade Current Target for iPad; make run-time checking for symbols using [[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] function. But when I start my application on device - iPhone with OS 3.1.3 my apllication is crashes with next log: Tue May 25 18:00:28 unknown SpringBoard[24] <Notice>: MultitouchHID(208b30) uilock state: 1 -> 0 Tue May 25 18:00:29 unknown SpringBoard[24] <Notice>: MultitouchHID(292580) device bootloaded Tue May 25 18:00:34 unknown UIKitApplication:...[0xaa0f][1517] <Notice>: dyld: Symbol not found: _MPMoviePlayerWillEnterFullscreenNotification Tue May 25 18:00:34 unknown UIKitApplication:...[0xaa0f][1517] <Notice>: Referenced from: /var/mobile/Applications/876EA35E-5756-436B-A9E2-5481D4D62050/....app/... Tue May 25 18:00:34 unknown UIKitApplication:...[0xaa0f][1517] <Notice>: Expected in: /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer Tue May 25 18:00:35 unknown kernel[0] <Debug>: launchd[1517] Builtin profile: container (seatbelt) Tue May 25 18:00:35 unknown kernel[0] <Debug>: launchd[1517] Container: /private/var/mobile/Applications/876EA35E-5756-436B-A9E2-5481D4D62050 (seatbelt) Tue May 25 18:00:35 unknown ReportCrash[1518] <Notice>: Formulating crash report for process cnetmobile[1517] Tue May 25 18:00:36 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:...[0xaa0f]) Job appears to have crashed: Trace/BPT trap Tue May 25 18:00:36 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:...[0xaa0f]) Throttling respawn: Will start in 2147483646 seconds Tue May 25 18:00:36 unknown SpringBoard[24] <Warning>: Application '...' exited abnormally with signal 5: Trace/BPT trap Tue May 25 18:00:36 unknown ReportCrash[1518] <Error>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/..._2010-05-25-180034_...-iPhone.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0 Tue May 25 18:01:36 unknown SpringBoard[24] <Notice>: MultitouchHID(208b30) uilock state: 0 -> 1 As you can see the error is "Symbol not found: _MPMoviePlayerWillEnterFullscreenNotification". This symbol is notification available in MediaPlayer.framework starting from iPhone OS 3.2 So, what am I doing wrong? What I should do to have universal application working correct on OS 3.2 (with new available functionality) and older OSes (with their functionality)?

    Read the article

  • video is not playing on ipad(device) when i use a separate audio track with it

    - by sujith1406
    In my application i need to play a video(silent ) together with another audio.i am using mpmovieplayercontroller for video and avaudioplayer for audio.the problem is on device (for ipad) the video is not playing .it is working perfect on ipad and iphone simulator .also on iphone .i am using ipad (os 3.2 ) installed.why is this so?? this is the code i am using NSString *trackname=[dict objectForKey:@"AudioFile"]; NSLog(@"track--->%@",trackname); NSString *newAudioFile = [[NSBundle mainBundle] pathForResource:trackname ofType:@"mp4"]; player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:newAudioFile] error:NULL]; if(error) { NSLog(@"%@",&error); } [player prepareToPlay]; [player play]; player.numberOfLoops=0; slider.maximumValue=player.duration; slider.minimumValue=0; [playpausebtn setBackgroundImage:[UIImage imageNamed:@"pausebutton.png"] forState:UIControlStateNormal]; timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES]; NSString *videoFile = [[NSBundle mainBundle] pathForResource:@"video-track" ofType:@"mp4"]; moviePlayer=[[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:videoFile]]; [[moviePlayer view] setFrame: [videoView bounds]]; // frame must match parent view [videoView addSubview: [moviePlayer view]]; [videoView setBackgroundColor:[UIColor blackColor]]; moviePlayer.repeatMode=MPMovieRepeatModeOne; moviePlayer.controlStyle=MPMovieControlStyleNone; [moviePlayer play];

    Read the article

  • MPMoviePlayerController on large videos causes massive memory spike, and a level 1 memory warning

    - by Shizam
    When viewing images my application hums along nicely with low memory consumption, once I try to watch a video using MPMoviePlayerController memory usage spikes way up, dwarfing the previous memory graph and if I play the video it causes a 'memory warning. Level=1' message. The video files (mp4) aren't even that big, 40MB or so, and it doesn't matter if I play the file streamed from a URL or loaded from a local file, actually the memory spike is even worse if I try to stream it. Here is the code I use to create the player: if (_photo.videoPath != nil) { _movieViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:_photo.videoPath]]; } else { _movieViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:_photo.videoURL]]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoMetaListener:) name:MPMovieDurationAvailableNotification object:_movieViewController.moviePlayer]; _movieViewController.moviePlayer.scalingMode=MPMovieScalingModeAspectFit; _movieViewController.moviePlayer.shouldAutoplay = YES; _movieViewController.moviePlayer.controlStyle = MPMovieControlStyleEmbedded; Anybody else running into issues playing video? Also I checked for leaks, there are none reported.

    Read the article

  • Strange crashes when using MPMoviePlayerController in iPad and iPad simulator with iOS 4.2.

    - by Dave L
    I'm getting crashes when trying to play a movie using MPMoviePlayerController on the iPad and in the iPad simulator using iOS 4.2. I am building using xcode 3.2.5 and the 4.2 SDK. When running on an iPad using iOS 3.2 or in the iPad simulator 3.2, the same code works fine, but on an iPad running 4.2 or in the iPad simulator 4.2, it crashes. The crash is due to an exception for calling an unknown selector down somewhere deep in the cocoa libraries, something tries to call a selector called "setHitRectInsets:" on a UIButton object. Also, the crash happens after control has returned to the main event loop. Anybody have any idea what might be causing this? Here is the code (roughly, some extraneous stuff deleted that doesn't seem to have any effect) that is crashing: NSString *fullMovieFilename = [[NSBundle mainBundle] pathForResource:@"movie" ofType:@"m4v"]; NSURL *movieURL = [NSURL fileURLWithPath:fullMovieFilename]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; moviePlayer.controlStyle = MPMovieControlStyleNone; // crash happens regardless of the setting here [moviePlayer.view setFrame:self.view.bounds]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES]; // crash happens whether i use fullscreen or not [moviePlayer play]; The same code also works just find if I build using Xcode 3.2.3 and the 4.0 SDK. The crash stack trace looks like this: 2011-03-04 23:08:22.017 MyApp[31610:207] -[UIButton setHitRectInsets:]: unrecognized selector sent to instance 0x990bc60 2011-03-04 23:08:22.020 MyApp[31610:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setHitRectInsets:]: unrecognized selector sent to instance 0x990bc60' *** Call stack at first throw: ( 0 CoreFoundation 0x0151abe9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0166f5c2 objc_exception_throw + 47 2 CoreFoundation 0x0151c6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x0148c366 ___forwarding___ + 966 4 CoreFoundation 0x0148bf22 _CF_forwarding_prep_0 + 50 5 MediaPlayer 0x011b5bdb -[MPTransportControls createButtonForPart:] + 380 6 MediaPlayer 0x011b65d5 -[MPTransportControls _updateAdditions:removals:forPart:] + 110 7 MediaPlayer 0x011b4d78 -[MPTransportControls _reloadViewWithAnimation:] + 299 8 MediaPlayer 0x011b621a -[MPTransportControls setVisibleParts:] + 49 9 MediaPlayer 0x011b6e4a -[MPTransportControls initWithFrame:] + 173 10 MediaPlayer 0x011f9188 -[MPInlineTransportControls initWithFrame:] + 78 11 MediaPlayer 0x011f193a -[MPInlineVideoOverlay layoutSubviews] + 158 12 QuartzCore 0x00d6e451 -[CALayer layoutSublayers] + 181 13 QuartzCore 0x00d6e17c CALayerLayoutIfNeeded + 220 14 QuartzCore 0x00d6e088 -[CALayer layoutIfNeeded] + 111 15 MediaPlayer 0x011f130c -[MPInlineVideoOverlay setAllowsWirelessPlayback:] + 46 16 MediaPlayer 0x011f5b0d -[MPInlineVideoViewController _overlayView] + 526 17 MediaPlayer 0x011f6359 -[MPInlineVideoViewController _layoutForItemTypeAvailable] + 1350 18 Foundation 0x000e56c1 _nsnote_callback + 145 19 CoreFoundation 0x014f2f99 __CFXNotificationPost_old + 745 20 CoreFoundation 0x0147233a _CFXNotificationPostNotification + 186 21 Foundation 0x000db266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 22 Foundation 0x000e75a9 -[NSNotificationCenter postNotificationName:object:] + 56 23 MediaPlayer 0x01184dd6 -[MPAVItem _updateForNaturalSizeChange] + 278 24 MediaPlayer 0x011818e4 __-[MPAVItem blockForDirectAVControllerNotificationReferencingItem:]_block_invoke_1 + 82 25 MediaPlayer 0x011899ba -[MPAVController _postMPAVControllerSizeDidChangeNotificationWithItem:] + 138 26 Foundation 0x000e56c1 _nsnote_callback + 145 27 CoreFoundation 0x014f2f99 __CFXNotificationPost_old + 745 28 CoreFoundation 0x0147233a _CFXNotificationPostNotification + 186 29 Foundation 0x000db266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 30 Celestial 0x052a35b2 -[NSObject(NSObject_AVShared) postNotificationWithDescription:] + 176 31 Celestial 0x052ab214 -[AVController fpItemNotification:sender:] + 735 32 Celestial 0x052b5305 -[AVPlaybackItem fpItemNotificationInfo:] + 640 33 Celestial 0x052a3d5c -[AVObjectRegistry safeInvokeWithDescription:] + 211 34 Foundation 0x000fa9a6 __NSThreadPerformPerform + 251 35 CoreFoundation 0x014fc01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 36 CoreFoundation 0x0145a28b __CFRunLoopDoSources0 + 571 37 CoreFoundation 0x01459786 __CFRunLoopRun + 470 38 CoreFoundation 0x01459240 CFRunLoopRunSpecific + 208 39 CoreFoundation 0x01459161 CFRunLoopRunInMode + 97 40 GraphicsServices 0x01e4f268 GSEventRunModal + 217 41 GraphicsServices 0x01e4f32d GSEventRun + 115 42 UIKit 0x0038a42e UIApplicationMain + 1160 43 MyApp 0x0000837a main + 102 44 MpApp 0x00002009 start + 53 ) terminate called after throwing an instance of 'NSException' Been fighting with this for several days, and have searched the internet quite a bit for anybody having similar problems, all with no luck. Any suggestions would be greatly appreciated.

    Read the article

  • Taking video from video camera and displaying it with MPMoviePlayerController IPhone SDK

    - by Daniel
    Has anyone tried taking a video from the camera and then using the video player provided to play it? When you take the video in portrait mode, sometimes the movie will play (when the player puts it in landscape mode) and when it puts it in portrait mode you cannot view the movie all you hear is sound,sometimes in landscape mode is flickers and does not play right, has anyone encountered this and found a way to fix it? My code to play the video looks like this: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSURL *urls=[info objectForKey:@"UIImagePickerControllerMediaURL"] ; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[info urls]]; if (moviePlayer) { [moviePlayer play]; } } I checked settings on the docs nothing seems like it would fix this...Thanks

    Read the article

  • MPMoviePlayerViewController crash on iOS 6.0

    - by user1471568
    I have a trouble in my app for the iOS6.0. It works perfectly fine on iOS 5.1.1 and under, but on the 6.0 shows exc_bad_access. please let me know why. -(void)endAniView{ if (moviePlayer!=nil) { [moviePlayer.moviePlayer stop]; [self removeFromSuperview]; } } this method called when user touches a button. and below are NEW ERROR MESSAGE and I've never seen before ios 6.0 2012-09-18 16:13:22.410 KiKiSong[992:907] [MPAVController] Autoplay: Disabling autoplay for pause 2012-09-18 16:13:22.411 KiKiSong[992:907] [MPAVController] Autoplay: Disabling autoplay 2012-09-18 16:13:22.450 KiKiSong[992:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0) please help me. Thanks

    Read the article

  • Problem with video playback on iPad with MPMoviePlayerViewController

    - by Symo
    Hello everybody... I have been fighting some code for about a week, and am hoping that someone else may have experienced this problem and can point me in the right direction. I am using the MPMoviePlayerViewController to play a video on the iPad. The primary problem is that it works FLAWLESSLY on the iPad Simulator, but will not play at all on the iPad. I have tried re-encoding the video to make sure that isn't an issue. The video I'm using is currently a 480x360 video encoded with H.264 Basline 3.0 with AAC/LC audio. The video plays fine on the iPhone, and also does play through Safari on the iPad. The video actually loads, and you can scrub through the video with the scrubber bar and see that it is there. The frames actually display, but just will not play. If you click play, it just immediately stops. Even when I have mp.moviePlayer.shouldAutoplay=YES set, you can see the player attempt to play, but only for a split second (maybe 1 frame?). I have tried just adding view with the following code: in .h ------ MPMoviePlayerViewController *vidViewController; @property (readwrite, retain) MPMoviePlayerViewController *vidViewController; in .m ------ MPMoviePlayerViewController *mp=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:videoURL]]; [mp shouldAutorotateToInterfaceOrientation:YES]; mp.moviePlayer.scalingMode=MPMovieScalingModeAspectFit; mp.moviePlayer.shouldAutoplay=YES; mp.moviePlayer.controlStyle=MPMovieControlStyleFullscreen; [videoURL release]; self.vidViewController = mp; [mp release]; [self.view addSubview:vidViewController.view]; float w = self.view.frame.size.width; float h = w * 0.75; self.vidViewController.view.frame = CGRectMake(0, 0, w, h); I have also just tried to do a: [self presentMoviePlayerViewControllerAnimated:self.vidViewController]; which I actually can not get to orient properly...always shows up in Portrait and almost completely off the screen on the bottom, and the app is only intended to run in either of the Landscape views... If anybody needs more info, just let me know. I'm about at my wits end on this. ANY help will be GREATLY appreciated.

    Read the article

  • iphone calls both if and else at the same time?

    - by David Schiefer
    Hi, I need to determine what file type a file is and then perform a certain action for it. this seems to work fine for some types, however all media types such as videos and sound files get mixed up. I determine the file type by doing this: BOOL matchedMP3 = ([[rowValue pathExtension] isEqualToString:@"mp3"]); if (matchedMP3 == YES) { NSLog(@"Matched MP3"); } I do this for various file types and just define an "else" for all the others. Here's the problem though. The iPhone calls them both. Here's what the log reveals: 2010-05-11 18:51:12.421 Test [5113:207] Matched MP3 2010-05-11 18:51:12.449 Test [5113:207] Matched ELSE I've never seen anything like this before. This is my "matchedMP3" function: BOOL matchedMP3 = ([[rowValue pathExtension] isEqualToString:@"mp3"]); if (matchedMP3 == YES) { NSLog(@"Matched MP3"); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSFileManager *manager = [NSFileManager defaultManager]; self.directoryContent = [manager directoryContentsAtPath:documentsDirectory]; NSString *errorMessage = [documentsDirectory stringByAppendingString:@"/"]; NSString *urlAddress = [errorMessage stringByAppendingString:rowValue]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:urlAddress]]; moviePlayer.movieControlMode = MPMovieControlModeDefault; moviePlayer.backgroundColor = [UIColor blackColor]; [moviePlayer play]; } and here's the else statement: else { NSLog(@"Matched ELSE"); [[NSUserDefaults standardUserDefaults] setObject:rowValue forKey:@"rowValue"]; NSString*rowValue = [[NSUserDefaults standardUserDefaults] objectForKey:@"rowValue"]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSFileManager *manager = [NSFileManager defaultManager]; self.directoryContent = [manager directoryContentsAtPath:documentsDirectory]; NSString *errorMessage = [documentsDirectory stringByAppendingString:@"/"]; NSString *urlAddress = [errorMessage stringByAppendingString:rowValue]; webViewHeader.prompt = rowValue; [documentViewer setDelegate:self]; NSString *encodedString = [urlAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; //Create a URL object. NSURL *url = [NSURL URLWithString:encodedString]; //URL Requst Object NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //Load the request in the UIWebView. [documentViewer loadRequest:requestObj]; [navigationController pushViewController:webView animated:YES]; } I can't see a reason why it wouldn't work. What happens is that both the webview and the MediaPlayer toggle their own player, so they overlap and play their sound/video a few secs apart from each other. Any help would be appreciated & thank for you taking the time to read through my code.

    Read the article

  • Problem streaming video on iPhone, only audio is playing

    - by Sheehan Alam
    I am trying to stream a video using MPMoviePlayerController but only audio is working. How can I get the video to appear? - (void)loadView { NSString *url = @"http://d1xt8xjto3lfs9.cloudfront.net/060810/afternoonupdate060810.mov"; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]]; [moviePlayer play]; }

    Read the article

  • MPMoviePlayerController - streaming works on 3GS, not on anything pre-3GS

    - by Canada Dev
    I am having some serious issues and annoyances with MPMoviePlayerController. In my app you can watch trailers for some movies in .mov format. I have tested with a friend and had users report that it does not work on their device, which are all 3G. I have tested on my own, a 3GS and playback works fine. I have tried on a 1st gen iPhone and it doesn't work. So I am lead to believe it's a memory issue, and that it's simply stopping the playback and returning to the previous screen. Below is the code I use to launch the player, which is straight out of the MoviePlayer example from Apple. MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:trailerURL]]; if (mp) { self.moviePlayer = mp; [mp release]; [self.moviePlayer play]; } I have tried to check the NSError from the notifications, but the only thing I get is "An unknown playback error occurred" for both the localizedDescription and localizedRecoverySuggestion, making it impossible to figure out exactly why it's not working. I have seen many examples of people who just have issues with the movie player, but it's starting to annoy me that it sometimes seem to work fine and other times it just doesn't (again, appearing like a memory issue). Thanks for any help/feedback provided

    Read the article

  • iPad MPMoviePlayerController only hearing audio, no videos!

    - by Steph Moreau
    I am currently rebuilding my app for the iPad. I would like to play the videos sourced online. I display the information and when i go to play the video all i get is the audio... No video is shown at all. My page looks exactly the same except that i have some "background" noise. These are the same videos i use on the iPhone app and they work perfectly This is the code that i call to play my videos - (IBAction) playMovie{ NSURL *url = [NSURL URLWithString:vidMovie]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:url]; [moviePlayer play]; } I am using this on a button on the right side view of a splitViewController. I get the same result in my simulator as on an iPad. Not sure if i'm missing something, but if anyone can help it would be greatly appreciated!

    Read the article

1 2  | Next Page >