Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Tenho um projeto para fazer um aplicativo que execute o vídeo direto na view, sem controlers e sem full screem. Mas tabém preciso adicionar alguns botões por cima do vídeo. Alguem tem alguma idéia?

Exemplo:

http://itunes.apple.com/br/app/meu-bahianinho/id477116555?mt=8

Link para o comentário
Compartilhar em outros sites

  • Respostas 1
  • Criado
  • Última resposta

Top Postadores Neste Tópico

Dias Populares

Top Postadores Neste Tópico

Pra quem precisar, segue o código

ViewController.h


#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController : UIViewController{
MPMoviePlayerViewController *playerViewController;
}
@property (retain, nonatomic) IBOutlet UIView *viewMovie;
- (void) movie1;
@end
[/CODE]

ViewController.m

[CODE]
#import "ViewController.h"
@interface ViewController(MovieControllerInternal)
-(void)moviePlayBackDidFinish:(NSNotification*)notification;
@end
@implementation ViewController
@synthesize viewMovie;
- (void)viewDidLoad
{
[super viewDidLoad];
[self movie1];
}
- (void)viewDidUnload
{
[self setViewMovie:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
- (void)dealloc {
[viewMovie release];
[super dealloc];
}
#pragma mark - Ações
- (void) movie1 {
NSLog(@"w: %f - h: %f", viewMovie.frame.size.width, viewMovie.frame.size.height);
UIView *movieContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewMovie.frame.size.width, viewMovie.frame.size.height)];
//Do any other positioning of the view you would like
NSString *path = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:path];
MPMoviePlayerController *movie = [[MPMoviePlayerController alloc] initWithContentURL:url];
movie.view.frame = movieContainer.bounds; //Make sure this is the bounds of its parent view
movie.scalingMode = MPMovieScalingModeFill;
movie.controlStyle = MPMovieControlStyleNone;
movie.shouldAutoplay = YES;
movie.repeatMode = MPMovieRepeatModeOne;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:movie];
[movieContainer addSubview:movie.view];
[viewMovie addSubview:movieContainer];

[movieContainer release];
}
#pragma mark - MediaDelegate
- (void)moviePlayBackDidFinish:(NSNotification *) aNotification{

MPMoviePlayerController *player = [aNotification object];
[player setFullscreen:NO animated:YES];
[player.view removeFromSuperview];
[player stop];
player.initialPlaybackTime = -1.0;
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];
[player release];
player=nil;
[self movie1];
}
@end
[/CODE]

Link para o comentário
Compartilhar em outros sites

Participe do debate

Você pode postar agora e se registrar depois. Se você tem uma conta, entre agora para postar com ela.

Visitante
Responder este tópico…

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Limpar editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.



  • Estatísticas do Fórum

    • Total de Tópicos
      56.8k
    • Total de Posts
      465.7k
×
×
  • Criar Novo...