-1

ビデオは配列されています。その動画を再生したいです。

ビデオがサーバーにあることを意味します。そして、ビデオは配列されています。ビデオの再生方法の辞書からその配列ia辞書を保存しました

以下のコードは正しいか間違っていますか間違っている場合は正しいものを教えてください

enter code here NSMutableDictionary *dict;


dict =[Videoarray objectAtIndex:0];
NSURL *Movie = [[NSURL alloc] initWithString:[dict valueForKey:@"url"]];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:Movie];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
MPMoviePlayerController *movie = [[MPMoviePlayerController alloc] initWithContentURL:Movie];
movie.view.frame = CGRectMake(5,5,310, 165);
movie.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | 
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[scroll addSubview:movie.view];
[movie play];
4

1 に答える 1

2

これは、一連のビデオを連続して再生するための非常に大まかなコードです。

-(void)viewDidLoad { 
     [self setUpPlayer];
}

-(void)setUpPlayer {
   if(i <= [videoArray count]) {
        player = [[MPMoviePlayerController alloc] initWithContentURL:[videoArray objectAtIndex:i]];
        i++; //use a static integer outside these functions as an index
        [NSNotificationCenter defaultCenter]addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
        [player play];
    }
}


- (void) movieFinishedCallback:(NSNotification*) aNotification {
    player = [aNotification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];    
    [self setUpPlayer];
 }
于 2012-07-09T19:31:23.227 に答える