Ir para conteúdo
Visualizar no app

Uma forma melhor de navegar. Saiba mais.

MM Fórum

Um app em tela cheia na sua Tela de Início com notificações push, avisos e mais.

Para instalar este app no iOS/iPadOS
  1. Toque no ícone de Compartilhamento no Safari
  2. Role o menu e toque em Adicionar à Tela de Início.
  3. Toque em Adicionar no canto superior direito.
Para instalar este app no Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Vídeos direto na view

Featured Replies

  • Respostas 1
  • Visualizações 620
  • Criado
  • Última resposta

Top Postadores Neste Tópico

Dias Populares

Postado
  • Autor

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]

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…

Quem Está Navegando 0

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

Conta

Navegação

Buscar

Buscar

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.