Tag: mpmovieplayercontroller

警告:在正常情况下,_fillInQueueWithExtraSpace:ignoreExistingItems:不应该被重新input

这是我的class级pipe理我的video: #import "video.h" #import <MediaPlayer/MediaPlayer.h> @interface video() { MPMoviePlayerController* videoView; } @end @implementation video static video *sharedSingleton = nil; + (video *)sharedSingleton { @synchronized() { if (!sharedSingleton) sharedSingleton = [[super allocWithZone:NULL] init]; return sharedSingleton; } return nil; } – (id)init { self = [super init]; CGRect dimVideo = CGRectMake(0, 0, 472, 400); NSURL* videoPath = […]

iOS:播放需要validation的video在QuickLook中播放,但不在MPMoviePlayerViewController中播放

我使用SOAP web servicelogin到我的服务器。 login后,我正在查看的许多文件只能用于login用户,所以iOS必须在NSURL创build会话或其他内容。 当试图使用MPMoviePlayerViewController预览video文件时,它不会工作,它只是加载viewController,然后解散它。 如果我使用QuickLook它可以工作,可能是因为我先在本地下载video,然后查看它。 但是,我不想这样做,我想使用MPMoviePlayerViewControllerstreamvideo,因为我不希望用户不得不下载整个video文件。 我已经看到有关使用NSURLCredentialpost,但这似乎不适用于我。 我使用(显然添加了我自己的个人信息): /** * Play media session * * @version $Revision: 0.1 */ – (void)playMediaWithURL:(NSString *)mediaURL { // Authenticate NSURLCredential *credential = [NSURLCredential credentialWithUser:@"myusername" password:@"mypassword" persistence:NSURLCredentialPersistenceForSession]; NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc] initWithHost:@"mysite.com" port:80 protocol:@"http" realm:nil authenticationMethod:NSURLAuthenticationMethodDefault]; [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace]; // The movie player NSURL *movieURL = [NSURL […]

player.duration在MPMoviePlayerController中总是显示为零的video文件

我正在使用此代码在mpmediaplayer控制器中播放一个小video MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:videostr]]; 其中videostr是该video文件的path。 现在我需要得到那个video文件的长度,我使用这个代码。 length = player.duration; 但总是显示0.000。 但是video播放不错。 我正在通过search代码来获取video时长是player.duration 。 我也尝试一些其他的代码 AVURLAsset *asset = [[[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:videostr] options:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], AVURLAssetPreferPreciseDurationAndTimingKey, nil]] autorelease]; NSTimeInterval duration; if (asset) duration = CMTimeGetSeconds(asset.duration) ; NSLog(@">>>>>>>>>>>>>>>>>>>> %f", asset.duration); 即使它显示为零。可以帮助我的任何人。 预先感谢。

iOS 7 MPMoviePlayerController seek forwardbutton将video带到End并显示黑屏

我在iOS 7中遇到了MPMoviePlayerController的一个问题。我进入全屏模式,然后在查找前进button(>> |)上单击(仅单击一次),video播放结束,并显示一个带有“正在载入”文本的黑屏。在标题上。 我注册了“ MPMoviePlayerPlaybackStateDidChangeNotification ”的通知。 **[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerPlaybackStateDidChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:self.player];** 它不会被点击寻找前进button被解雇。 另外注册“ MPMoviePlayerPlaybackDidFinishNotification ” **[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerPlaybackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];** 我得到“ MPMovieFinishReasonPlaybackEnded ”事件发射的单击寻求前进button。 任何人都知道原因? 这是苹果的错误吗? 我需要停止单击显示黑屏的行为,或者只是禁用单击查找前进button,以免发生任何事情。 任何人都知道如何做到这一点?

如何在iPhone上添加video文字

我想在MPMoviePlayerViewController正在播放的video上添加一个文本或string,使其成为正在播放的video的一部分。 所以,当我在Facebook或Twitter上发布video时,文本必须显示在video上方。 为此,我尝试获取video的所有帧,然后在每个帧上写入文本,然后再制作所有这些帧的video。 但是这样,我得到内存问题,并在设备上崩溃。 – (NSArray*)getVideoFramesFromMovieController:(MPMoviePlayerViewController*)mpMoviePlayerVC { NSLog(@"Getting frames from a video asset."); // videoFrames = [NSMutableArray array]; NSMutableArray *videoFrames = [NSMutableArray array]; for(float i= 0; i <= mpMoviePlayerVC.moviePlayer.duration; ) { UIImage *singleFrameImage = [mpMoviePlayerVC.moviePlayer thumbnailImageAtTime:i timeOption:MPMovieTimeOptionExact]; [videoFrames addObject:singleFrameImage]; NSLog(@"Got frame number : %d",[videoFrames count]); i = i + (1/self.frameRate) ; //frame capturing duration ie […]

在iOS中通过从ALAsset中检索的url播放video

我对Obj-C和块的想法还是比较新的。 我阅读这篇文章,关于显示从ALAssets中检索的URL的图像 : 显示从iPhone中的ALAsset检索到的URL的图像 除了能够使用ALAsset框架查看UITableView中的图片文件ALAsset ,我还希望能够播放存储在图片文件夹中的video。 video资源就像一张图片一样,所以我希望能够在桌面上点击这个video列表并让它播放。 (换句话说,我想用Assets Library Framework播放video) 这可以用MPMoviePlayerController来完成吗? 从这个post上面我收集我需要在这个函数内的代码来获取一个video文件的资产URL: ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { }; 如果这是正确的,我需要将什么代码放入该函数,以便我可以通过MPMoviePlayerController成功播放video? 仅供参考,我在UITableView显示资产的代码在这里: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *CellIdentifier = @"id"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } [[cell imageView] setImage:[UIImage imageWithCGImage:[[assets objectAtIndex:indexPath.row] […]

MPMoviePlayerViewController,删除quicktime符号/添加背景图像?

我有一个播放audio的MPMoviePlayerViewController。 我想删除Quicktime徽标和/或添加一个自定义的背景图像播放器,但保持播放控制。 我发誓我已经在iOS 5之前做过这个,但是我不能重新弄明白! 我已经尝试过的事情: 添加一个子视图到MPMoviePlayerViewController。 放置在播放控件上的子视图,不好。 带有模式图像的moviePlayer的-setBackgroundColor。 什么都不做 -setView在整个MPMoviePlayerViewController上。 正如预期的那样,播放控件和导航栏消失了。 我想这可以工作,但我需要手动重新创build所有的播放控制,但我真的不喜欢。 任何人都可以点亮一下吗?

将MPMoviePlayerController的视图添加到UIView

我想将MPMoviePlayerController添加到UIView 。 首先,我把一个视图放在xib文件中,命名为youTubeView。 youtubePlayer是MPMoviePlayerController 。 [youtubePlayer.view setFrame:youTubeView.frame]; [youTubeView addSubview:youtubePlayer.view]; [youtubePlayer play]; 我想要将youtubePlayer的视图覆盖在youTubeView上。 但youtubePlayer的视图变宽了,它只是覆盖youTubeView的一部分。 为什么?

得到消息“警告:在正常情况下,_fillInQueueWithExtraSpace:..”和MPMoviePlayer旋转不工作在iPad IOS 5.1

这是我的第一篇文章,可能看起来不正确。 所以,我必须在iPad上使用cocos2d进行轮换(5.1)我在每个方向上使用2个不同的video。 在那里我有两个问题: 该应用程序以纵向模式开始,并正常播放video。 我打电话(播放)video5-10次,当video完成我旋转模拟器。 视图旋转,但当我打电话(播放)video – 它显示白色屏幕和下一个消息: “警告:在正常情况下,_fillInQueueWithExtraSpace:ignoreExistingItems:不应该被重新input。” 然后,如果我再次旋转屏幕(多次) – 并以横向模式播放,则播放video效果很好。 反之亦然。 当我从风景模式开始 视图旋转的问题。 当我将视图旋转到左/右横向(从纵向) – 不能向后旋转视图。 所以我只能顺时针或逆时针旋转。 如何解决它? -(id) init { pathToVideoP = [[NSBundle mainBundle] pathForResource:@"video_portrait" ofType:@"mp4"]; pathToVideoL = [[NSBundle mainBundle] pathForResource:@"video_landscape" ofType:@"mp4"]; theMovieP = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:pathToVideoP]]; theMovieL = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:pathToVideoL]]; } -(void) playVideoButtonClicked { movieButton.visible = FALSE; if […]

MPMoviePlayerController改变video速度

有没有办法使用MPMoviePlayerController倍速播放video? myMPMoviePlayerController.currentPlaybackRate = 2.f 不会改变任何东西。