Tag: mpmovieplayercontroller

MPMoviePlayerController切换电影导致白色闪光

我有一个小UIView,显示一个重复的电影。 当用户点击一个button时,另一个电影被加载并显示在相同的UIView中。 问题是在第一个电影的移除和第二个电影的显示之间有半秒的“闪光”。 有没有删除这个? – (void) setUpMovie:(NSString*)title { NSString *url = [[NSBundle mainBundle] pathForResource:title ofType:@"mp4"]; MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]]; [[player view] setFrame:self.movieView.bounds]; [self.movieView addSubview:player.view]; if ([title isEqualToString:@"Bo_idle_02"]) { [player setRepeatMode:MPMovieRepeatModeOne]; } else { [player setRepeatMode:MPMovieRepeatModeNone]; } [player setControlStyle:MPMovieControlStyleNone]; [player play]; } – (void) startDanceAnimation { [self setUpMovie:@"Bo_dance_02"]; return; }

MPMoviePlayerController在iOS6中进入全屏后中断/停止

我有一个MPMoviewPlayerViewControllerembedded到UIView对象。 当我在embedded式模式下启动播放器时,一切正常,并按预期进行。 如果用户点击全屏切换(或者如果我使用setFullscreen:animated以编程方式更改为全屏),则播放器全屏显示,电影播放另一秒,之后屏幕变黑,仅显示“ Loading … ”消息。 此行为仅在iOS 6(也是iPad 6.0 Simulator)上出现,在运行iOS 5的设备上一切正常。 电影来源是应用程序包中的本地文件。 在播放和进入全屏时,debugging输出如下: 2012-09-26 15:24:48.251 [39895:c07] [MPAVController]自动播放:停用自动播放暂停 2012-09-26 15:24:48.252 [39895:c07] [MPAVController]自动播放:禁用自动播放 2012-09-26 15:24:48.262 [39895:c07] [MPAVController]自动播放:启用自动播放 2012-09-26 15:24:48.265 [39895:c07] [MPAVController]自动播放:可能保持或满缓冲区:0 2012-09-26 15:24:48.266 [39895:c07] [MPAVController]自动播放:跳过自动播放,没有足够的缓冲跟上。 2012-09-26 15:24:48.267 [39895:c07] [MPAVController]自动播放:可能保持或满缓冲区:0 2012-09-26 15:24:48.268 [39895:c07] [MPAVController]自动播放:跳过自动播放,没有足够的缓冲跟上。 2012-09-26 15:24:48.276 [39895:c07] [MPAVController]自动播放:跳过自动播放,禁用(当前项目:0,播放器:1) 2012-09-26 15:24:48.286 [39895:c07] [MPCloudAssetDownloadController]为媒体项目ID请求优先级:0 2012-09-26 15:24:48.938 [39895:c07] [MPAVController]自动播放:启用自动播放 2012-09-26 15:24:48.940 […]

在Swift中从服务器播放video文件

我正试图使用​​Swift从服务器播放video。 我已经导入了MediaPlayer框架,这里是我的代码: import UIKit import MediaPlayer class VideoViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() var url:NSURL = NSURL(string: "http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v") var moviePlayer = MPMoviePlayerController(contentURL: url) moviePlayer.view.frame = CGRect(x: 20, y: 100, width: 200, height: 150) self.view.addSubview(moviePlayer.view) moviePlayer.fullscreen = true moviePlayer.controlStyle = MPMovieControlStyle.Embedded } } 当我在模拟器中运行时,我只会得到一个黑盒子,但不pipe在哪里尝试加载video,都不会播放video。 UPDATE 这是当前的代码 var url:NSURL = NSURL(string: "http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v") var moviePlayer = […]

我的iPhonevideo只能在肖像模式下播放

我正在使用MPMoviePlayerController播放电影。 电影以纵向模式启动(因为这是应用程序使用的唯一模式),即使设备旋转,也会保留在那里。 我从来没有明确设置shouldAutoRotateetc。 function来响应风景和肖像,因为我不希望我的意见resize。 有没有办法让video响应肖像和风景旋转? 任何帮助将不胜感激。 仅供参考:这是我的代码 NSString *filepath = [[NSBundle mainBundle] pathForResource:@"TestMovie" ofType:@"m4v"]; NSURL *fileURL = [NSURL fileURLWithPath:filepath]; MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL]; //Listen so we can clean up after the movie is over [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController]; [self.view addSubview:moviePlayerController.view]; [moviePlayerController setFullscreen:YES animated:YES]; [moviePlayerController play];

使用MPMoviePlayerController或AVPlayer播放M4V受保护的内容(iOS)

有没有办法让MPMoviePlayerController(或甚至更低级别的AVPlayer)从iTunes Store中播放受保护的M4V文件? 在此使用官方iTunes API: http : //www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html 我可以为电影,电视节目和音乐video获得“previewURL”。 音乐video似乎不受保护,但电影和电视节目是。 例如,这是来自The Beatles的音乐video的预览URL(实际上是一个纪录片,但不pipe): http : //a809.v.phobos.apple.com/us/r1000/006/Video/72/fe/ 52 / mzm.bxhrrlns..640×480.h264lc.upm4v 这是“辛普森一家”剧集的预览url: http : //a911.v.phobos.apple.com/us/r1000/017/Video/ec/cc/cf/mzi.mnuqbbcl..640×480.h264lc。 d2.p.m4v 音乐video将使用MPMoviePlayerController播放,但辛普森一家的video根本不播放。 (当与MPMoviePlayerViewController一起使用时,视图控制器将以模态方式显示,然后在没有任何用户交互的情况下立即解散。 如果您在QuickTime Pro中查看这两个URL,唯一明显的区别是第二个被列为“受保护”,这将导致人们认为MPMoviePlayerController无法播放受保护的内容,即使该内容是直接来自苹果。 在文档的“支持的格式”部分,M4V没有具体列出,但它当然有效。 我找不到任何引用受保护内容的文档。 如果有人知道在应用程序中或通过其他方式播放此内容的方法,那么只是好奇而已。 (调用[UIApplication … openURL]也不起作用,因为Mobile Safari也不会播放内容。) 这是在iOS 4.x上。 谢谢。

完成按下电影播放器​​后还原为肖像?

我有一个MPMoviePlayer工作。 它被devise为在视图中显示邮票大小的电影作为子视图。 当手机旋转到横向时,进入全屏模式。 而当手机是肖像时,它会进入邮票肖像模式。 唯一的问题是,当我在横向模式下按Done时,它保持横向,邮票大小的电影,而不是踢回肖像.. 这是我的一些代码: -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) { [moviePlayerController setFullscreen:YES animated:YES]; } else { [moviePlayerController setFullscreen:NO animated:YES]; } } – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft; } 按完成后,我怎样才能让它进入肖像模式?

MPMoviePlayerController正在播放YouTubevideo?

我find了一种在MPMoviePlayerController上播放YouTubevideo的方法。 为此只需要一个正确的url。 该url可能是在iframe中播放YouTubevideo后获得的。 我的UIWebView使用这个html: <html> <head> </head> <body style="margin:0"> <iframe class="youtube-player" type="text/html" width="280" height="200" src="http://www.youtube.com/embed/VJRKaQ52ImE" frameborder="0"> </iframe> </body> 所以在video矩形中点击播放后,我们可以在控制台中看到msg,如下所示: YT_Player[1520:207] setting movie path: http://v12.lscache4.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass%2Coc%3AU0hQR1NLVl9FSkNOMF9LRVpB&fexp=913518%2C904531%2C910211&itag=18&ip=0.0.0.0&signature=93772DDEDFE678D8EA1A2E4669B5634BD6D4E81E.58DEF5203DEF07FB75F762D6C9C39536C84DE59C&sver=3&ratebypass=yes&expire=1312308000&key=yt1&ipbits=0&id=54944a690e762261 所以这里的问题是 – 如何获得YT_Player对象或如何生成“正确”的url?

当MPMoviePlayerController正在播放的时候,有没有什么办法来截图

我尝试了下面的步骤捕捉屏幕截图,但得到MPMoviePlayerController的黑色背景 -(UIImage*)screenshot { CGSize imageSize = [[UIScreen mainScreen] bounds].size; CGFloat imageScale = imageSize.width / FRAME_WIDTH; if (NULL != UIGraphicsBeginImageContextWithOptions) UIGraphicsBeginImageContextWithOptions(imageSize, NO, imageScale); else UIGraphicsBeginImageContext(imageSize); CGContextRef context = UIGraphicsGetCurrentContext(); for (UIWindow *window in [[UIApplication sharedApplication] windows]) { if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) { CGContextSaveGState(context); CGContextTranslateCTM(context, [window center].x, [window center].y); CGContextConcatCTM(context, [window transform]); […]

在模拟器中的airplay – objective-c

我已经在我的MPMoviePlayerController中将“allowedAirPlay”设置为“YES”,但AirPlaybutton没有出现。 iOS模拟器是否支持AirPlay? 举个例子,举个例子,如何通过苹果电视stream式传输video。

为什么我的MPMoviePlayerController不能播放?

我试图让一个基本的.movvideo文件播放使用下面的代码,但是当button我已经分配的行动被按下,唯一显示的是黑色的框架,但没有播放video。 任何帮助表示赞赏。 谢谢。 @implementation SRViewController -(IBAction)playMovie{ NSString *url = [[NSBundle mainBundle] pathForResource:@"OntheTitle" ofType:@"mov"]; MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath:url]]; // Play Partial Screen player.view.frame = CGRectMake(10, 10, 720, 480); [self.view addSubview:player.view]; // Play Movie [player play]; } @end