Tag: mpmovieplayercontroller

MPMoviePlayerController:我什么时候才能知道文件的下载量达到了10%?

我正在从我们的networking服务器播放video,我正在使用MPMoviePlayerController来播放它。 它首先在下载文件的同时播放它。 在下载文件时,每当video达到10%时,我都需要在networking服务器上发布日志。 我怎么知道文件的下载量达到了10%? 顺便说一句,我已经得到了文件大小,已经计算出任何文件的10%,我只想知道什么时候能够知道它已经下载了10%的文件? 谢谢

MPMoviePlayerController MovieAccessLogEvent – 膨胀的obserBitrate

我目前正在使用MPMoviePlayerController并分析video播放的指标。 具体来说,分析自适应比特率。 作为testing的一部分,我以一个固定的比特率( 995kbps )加载video的一个特定格式,然而当从我的MPMovieAccessLogEvent的observedBitrate属性中MPMovieAccessLogEvent ,这个值要大得多 – 大概是15mbps 。 是否有任何已知的理由,为什么这个比特率返回比回放的相当高? 我已经双重检查了所有的值,所有的回放,这是肯定的被夸大的observedBitrate到的比特率。 根据文件,这个值是: 下载到电影播放器​​的所有媒体的经验吞吐量,以每秒位数为单位。 更新 我在开发者论坛上发布了这个问题,并且收到了一个答案,这个答案依然只是猜想,不过也认为它可以帮助解决这个问题,也许会引发一个更好的答案。 https://devforums.apple.com/thread/216659?tstart=0 使用mediastreamvalidator来检查你的HLSvideo是非常值得的,它将会下载和测量你的分段比特率。

使用MPMoviePlayerController无法从video获取多个图像。 OSStatus -12433

我试图使用MPMoviePlayerController从选定的video文件中提取多个图像。 以下是我写的代码。 movie = [[MPMoviePlayerController alloc] initWithContentURL:[info objectForKey:UIImagePickerControllerMediaURL]]; NSNumber *time1 = [NSNumber numberWithInt:1]; NSNumber *time2 = [NSNumber numberWithInt:3]; NSNumber *time3 = [NSNumber numberWithInt:5]; NSArray *times = [NSArray arrayWithObjects:time1,time2,time3,nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleThumbnailImageRequestFinishNotification:) name:MPMoviePlayerThumbnailImageRequestDidFinishNotification object:movie]; [movie requestThumbnailImagesAtTimes:times timeOption:MPMovieTimeOptionExact]; 这是通知的处理程序 -(void)handleThumbnailImageRequestFinishNotification:(NSNotification*)note { NSDictionary *userinfo = [note userInfo]; NSError* value = [userinfo objectForKey:MPMoviePlayerThumbnailErrorKey]; if (value!=nil) { NSLog(@"Error: %@", […]

防止MPMoviePlayerController中断设备的主audio

我已经使用MPMoviePlayerController向我的应用程序添加了一个介绍性video。 video按预期播放。 但是,video不会 – 也不应该 – 有声音,但是,如果用户正在他们的设备上听音乐(例如),然后打开我的应用程序,音乐停止播放,因为我的video开始播放。 由于我的video没有声音,所以我希望播放video不要中断设备上的主audio。 我已经通过MPMoviePlayerController类看,并没有看到任何线索。 有没有办法做到这一点? 这是我的代码: – (void)setUpVideoPlayer { NSString *videoFilePath = [[NSBundle mainBundle] pathForResource:@"introVideo" ofType:@"MP4"]; NSURL *videoUrl = [NSURL fileURLWithPath:videoFilePath]; MPMoviePlayerController *player = [[MPMoviePlayerController alloc]initWithContentURL:videoUrl]; player.backgroundView.hidden = YES; player.movieSourceType = MPMovieSourceTypeFile; [player prepareToPlay]; [player setShouldAutoplay:YES]; [player setRepeatMode:MPMovieRepeatModeOne]; [player setFullscreen:YES]; [player setControlStyle:MPMovieControlStyleNone]; [player setScalingMode:MPMovieScalingModeAspectFill]; [player play]; player.view.translatesAutoresizingMaskIntoConstraints = NO; NSLayoutConstraint […]

视图上的事件显示更改(Youtube MPMoviePlayerViewController)

我想知道什么时候YouTube MPMoviePlayerViewController出现(以编程方式)后,点击了允许在iOS中播放video的UIWebView,以获得和控制这个视图。 因为我想从播放器获取信息,如当前的播放时间,加载时间…就像在一个普通的MPMoviePlayerViewController中。 谢谢

本地化MPMoviePlayerViewController的完成button

我正在使用MPMoviePlayerViewController来呈现video。 一切都按预期工作,但如果将设备的语言切换为德语,则“完成”button不会本地化。 我试图访问button,并将其设置为我自己的button实现像这样: MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; NSLog(@"%@", mp.navigationItem.leftBarButtonItem); // always null, but why? // override button with locale mp.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Zurück" style:UIBarButtonItemStyleDone target:self action:@selector(dismissMoviePlayer:)]; [self presentMoviePlayerViewControllerAnimated:mp]; 以前也有类似的问题,但是从来没有收到过任何答案: objective-c MPMoviePlayerViewController做过的button语言 。 谢谢你的帮助。

如何configuration我的服务器提供video文件播放与MPMoviePlayerViewController?

我想使用MPMoviePlayerViewController播放我的服务器上的video文件。 但它不起作用。 我的iOS代码如下: NSURL *mediaURL = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"http://127.0.0.1:3000/media/%@", @"sample_iTunes.mov"]]; self.player = [[MPMoviePlayerViewController alloc] initWithContentURL: mediaURL]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.player.moviePlayer]; self.player.moviePlayer.shouldAutoplay = YES; self.player.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; [self presentMoviePlayerViewControllerAnimated:self.player]; [self.player.moviePlayer prepareToPlay]; [self.player.moviePlayer play]; -(void)movieFinishedCallback:(NSNotification*)aNotification { NSLog(@"%@",[aNotification valueForKey:@"userInfo"]); MPMoviePlayerViewController* theMovie = [aNotification object]; } 而我从NSNotification得到的错误信息是: MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = 1; error = "Error Domain=MediaPlayerErrorDomain Code=-11850 […]

当进入背景时,MPMoviePlayerViewController变黑

我有MPMoviePlayerViewController问题,当应用程序进入背景,然后我再次启动它或去另一个viewControllers电影变成黑色! 我有我的菜单背景中播放的电影,这里是我的代码: EIDTED CODE: -(void)viewDidLoad { [self moviePlayer2]; } – (void) moviePlayer2 { NSString *path = [[NSBundle mainBundle] pathForResource:@"cloud" ofType:@"mp4"]; player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]]; player.view.userInteractionEnabled = YES; player.moviePlayer.repeatMode = YES; player.moviePlayer.scalingMode = MPMovieScalingModeFill; player.moviePlayer.controlStyle = MPMovieControlStyleNone; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackStateChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:[player moviePlayer]]; [[player moviePlayer] play]; [self.view addSubview:player.view]; } -(void) moviePlayBackStateChange: (NSNotification *) […]

尝试设置(空)audio设备采样率的错误“!dat”

我试图播放一个audio剪辑(使用AVAudioPlayer)和一个video剪辑(使用MPMoviePlayerController),这两个工作。 然后,我将这些文件检入到SVN中,并在另一台Mac上删除它们。 现在,当我尝试播放audio或video时运行应用程序(iPad应用程序)时,都会显示以下错误: 尝试设置(空)audio设备采样率的错误“!dat” 考虑到SVN破坏了文件,(即使Mac的QuickLook也能正常播放),我用Mac上的版本replace了它们。 不过,我仍然收到错误。 所有代码在两台机器上都完全相同,但是原来使用的Mac(MacBook Pro)将在模拟器中同时播放它们,但在第二台Mac(Mac Pro)上,它们将不会播放并出现此错误。 有谁知道这个错误是什么意思,或者我可以修复它(因为覆盖媒体文件不工作) 谢谢 播放audio的代码: NSError *error; [[AVAudioSession sharedInstance] setDelegate:self]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:&error]; NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Page_7.m4a", [[NSBundle mainBundle] resourcePath]]]; if (audioPlayer == nil) { audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; audioPlayer.numberOfLoops = 0; } if (audioPlayer == nil) NSLog(@"%@", [error […]

navigationBar和MPMoviePlayerController极其怪异的行为。 在iOS中的错误或我的错误?

我有一个MPMoviePlayerController对象,以纵向或横向播放全屏video。 如果我在播放video的同时旋转方向,并在video开始播放后的几秒钟内进行旋转,并且video状态栏可见,则在video结束时,我的导航栏非常完美。 但是,如果等到video状态栏消失几秒钟后进入video播放,然后旋转方向,当video结束时,我的navigationBar栏部分隐藏在状态栏的后面,就像向上推。 你有没有见过这样的事情? 我能够轻松地重新创build这个bug。 我创build了一个新的单一视图应用程序,并简单地添加一个button和一个导航栏。 如果我在播放video的同时旋转方向,点击启用全屏,video状态栏仍然可见,当video结束时,一切正常。 但是,如果我在video状态栏消失之后等待旋转,则当我旋转并且video结束时,导航栏将位于状态栏下方。 见图: iPhone图像 这是我正在使用的简单的代码: – (void) playMovie { NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource: @"movie" ofType: @"mov"]]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: url]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(moviePlayBackDidFinish:) name: MPMoviePlayerPlaybackDidFinishNotification object: moviePlayer]; moviePlayer.controlStyle = MPMovieControlStyleDefault; moviePlayer.shouldAutoplay = YES; [self.view addSubview: moviePlayer.view]; [moviePlayer setFullscreen: YES animated: YES]; […]