Note that there are some explanatory texts on larger screens.

plurals
  1. POMpMoviePlayerViewController closed after setContentURL
    primarykey
    data
    text
    <p>I make mpmovieplayerviewcontroller and load movie in it (from stream). Now I have call to setContentURL method that change URL and it works. Whenn app is first time started it shows view with button after button is pressed it opens movie player and load movie. But when I call code where is setContentURL player close it self first, go back to first view where I have to again click play button to again open player (so it remembers and load new URL). How to prevent player to not close it self when switching URL? This must be some small issue, please help :) This is code when play button is clicked (first view)</p> <pre><code>-(void)initializeMovieFromStream:(NSString *)var { if(player != nil) { NSString *title = [[NSString alloc] initWithFormat:@"%@%@%@", @"http://"]; NSURL *nurl = [NSURL URLWithString:title]; NSLog(@"Switching channel..."); [player.moviePlayer setContentURL:nurl]; isMoviePaused = NO; } else { NSString *title = [[NSString alloc] initWithFormat:@"%@%@%@", @"http://"]; NSURL *nurl = [NSURL URLWithString:title]; player = [[MPMoviePlayerViewController alloc] initWithContentURL:nurl]; [player.moviePlayer.view.window setUserInteractionEnabled:YES]; player.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; player.moviePlayer.controlStyle = MPMovieControlStyleNone; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedPlaying:) name:MPMoviePlayerPlaybackDidFinishNotification object:[player moviePlayer]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nowPlayingMovieDidChange:) name:MPMoviePlayerNowPlayingMovieDidChangeNotification object:nil]; [self presentModalViewController:player animated:YES]; //[self presentMoviePlayerViewControllerAnimated:player]; UIView *mv = player.view; //[mv setFrame:CGRectMake(0, 0, 320, 480)]; [mv addSubview:myOverlayChannelPicker]; [mv bringSubviewToFront:myOverlayChannelPicker]; // register this class to observe TestNotification that comes from OverlayChannelPicker [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTestNotification:) name:@"TestNotification" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseStreamNotificationHandler:) name:@"notiPauseStream" object:nil]; } -(void) movieFinishedPlaying: (NSNotification *)note { [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:[player moviePlayer]]; //[player release]; } </code></pre> <p>When URL need to be switch I use this nitification handler</p> <pre><code>- (void) receiveTestNotification:(NSNotification *) notification { NSString *stringFromNote = (NSString *)[notification object]; [switchableChannel setString:stringFromNote]; [self initializeMovieFromStream:stringFromNote]; } </code></pre> <p>It is solved I just change animation property to NO.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload