Tag: mpmovieplayercontroller

MPMoviePlayerController全屏模式问题

我的播放video文件的代码有问题。 每当我以全屏模式播放文件,播放不会占用我的所有屏幕。 这是相关的代码: NSURL *url = [NSURL fileURLWithPath:@"Somefile.mov"]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [moviePlayer setControlStyle:MPMovieControlStyleFullscreen]; [moviePlayer setFullscreen:YES]; moviePlayer.view.frame = self.switchView.frame; [self.switchView addSubview:moviePlayer.view]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackStateDidChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:moviePlayer]; [moviePlayer prepareToPlay]; [moviePlayer play]; 这是我得到的输出:

iPhone开发mpmovieplayer崩溃

我正在开发一款应用程序,让我可以通过iPhone远程播放iPad上的不同video。 我一直在跟随一个video播放器苹果的例子,但我一直有一些麻烦。 这些video播放效果很好,我可以从各种video中播放video,但在它们之间切换几次会崩溃,我在debugging器中得到这个: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An AVPlayerItem cannot be associated with more than one instance of AVPlayer' *** First throw call stack: (0x380da8bf 0x37c261e5 0x30acbcb5 0x30abc1f7 0x30ac3bf3 0x30c93d55 0x30c95f7b 0x380ad2dd 0x380304dd 0x380303a5 0x37e07fcd 0x31bb0743 0x25e5 0x257c) 这是我用来创build播放器的代码: MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentOfURL:movieURL]; if (player) { [self setMoviePlayerController:player]; […]

如何使MPMoviePlayerController忽略静音开关

我想使用MPMoviePlayerController播放video,但是我希望它忽略静音开关,类似于Youtubevideo播放器的行为。 有任何想法吗?

MPMoviePlayerController起始图像

在我的应用程序中,我创build的MPMoviePlayerController的实例作为一个黑盒子开始,看起来像这样(因为video开始黑和淡入): 不过,我正在设想一些更像用户友好的东西,像下面的例子那样有一个缩略图: 这是我创build的样机,但在消息应用程序中发送的video和video使用播放箭头。 我需要使用什么类来使用股票iOS播放箭头?

如何在iOS中使用MpMoviePlayerController在UISlider上显示缓冲数据?

我正在使用MPMoviePlayerController来播放audio,我想显示像这样的滑块缓冲数据… 我想在滑块中显示像红色部分的缓冲区数据。 我试图谷歌它。 但我没有得到任何解决scheme。 以及如何使滑块自定义? 提前致谢…

MPMoviePlayerController 5秒后停止播放 – Swift

我有一个video,我试图使用MPMoviePlayerController播放,它加载正常,但5秒后切出。 我发现这个post,但它并不适用于swift。 MPMoviePlayerController 5秒后停止播放video 这是我的代码。 import MediaPlayer class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. var moviePlayer: MPMoviePlayerController? let url = NSURL(string: "http://path/to/video.m3u8") moviePlayer = MPMoviePlayerController(contentURL: url) if let player = moviePlayer { player.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, […]

从MPMoviePlayerController标准控件中删除/隐藏全屏button

我想从MPMoviePlayerController标准控件中删除/隐藏全屏button,因为全屏模式造成了很多问题,也不是我的应用程序的要求。我只想play , stop , forward , reverse controls 。 有谁能够帮助我?

需要在mpmovieplayercontroller swift中显示video的图像

我已经在我的同事档案中提出了这个疑问,但还没有解决scheme。 请帮我解决这个问题。 我已经打了4个多小时。 到目前为止我做了: 我使用从画廊中selectvideo,并使用mpmovieplayercontroller在屏幕上显示。 在这里,我一个一个select2个video。 如果我select第一个video,并显示,当我移动加载第二个video,我的第一个video屏幕是black 。 但我需要在该播放器中显示video图像。 如何做到这一点,请帮助我 我的代码: import UIKit import AVFoundation import MobileCoreServices import AssetsLibrary import MediaPlayer import CoreMedia class ViewController: UIViewController,UIGestureRecognizerDelegate { var Asset1: AVAsset? var Asset2: AVAsset? var Asset3: AVAsset? var audioAsset: AVAsset? var loadingAssetOne = false // swt duplicate image for thumbnail image for audio @IBOutlet weak var […]

在MPMoviePlayerController顶部添加一个视图

我有一个播放全屏的MPMoviePlayerController。 然后我想在电影上面添加一个UIButton,但是不显示。 我已经尝试在电影视图上方插入视图,如下所示: mpc =[[MPMoviePlayerController alloc]initWithContentURL:url]; [mpc setMovieSourceType:MPMovieSourceTypeFile]; [self.view addSubview:mpc.view]; **[self.view insertSubview:self.backButton aboveSubview:mpc.view];** [mpc setFullscreen:YES]; mpc.controlStyle = MPMovieControlStyleNone; [mpc play]; 我也尝试添加子视图到电影控制器视图,就像我在类似的问题中读到的: **[mpc.view addSubview:self.backButton];** [self.view addSubview:mpc.view]; 当我logging子视图的列表时,我总是在MPMovieView和MPSwipable视图之后的最后一个位置获取button,但不显示。 编辑: 我已经能够通过禁用[mpc setFullscreen:YES]并将电影视图的框架设置为父视图的界限并设置纵横填充缩放模式来解决这个问题。 不是我想的最干净的解决scheme,但它适用于我。 mpc.view.frame = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.bounds.size.width, self.view.bounds.size.height); UIButton *myButton = [[UIButton alloc]initWithFrame:CGRectMake(100, 500, 100, 100)]; myButton.backgroundColor = [UIColor blueColor]; mpc.controlStyle = MPMovieControlStyleNone; mpc.scalingMode = MPMovieScalingModeAspectFit; [self.view […]

在collections视图单元中播放video,例如在Facebook应用时间轴中播放的video

我想在collections视图单元格中播放video,需求就像instagram时间线,播放video就像在Facebook时间线上播放video一样, 为此我使用了UICollectionViewCell巫婆我现在有一些图像没有video我是从画廊的图像,我正在使用相机拍摄的图像,我正在录制的video,每次我会有任何一个从上面出来,把我有添加到时间线。 例如,我们采取3vc第一个vc是有一些图像收集视图,我第二个vc我们得到的输出要么是video,图像,我正在把图像和图像的第一帧中的共同数组是在从VC3的VC3中,我将数组和输出videopathurl传递给使用通知中心的1stVC – (IBAction)sharebuttn:(id)sender { [self dismissViewControllerAnimated:YES completion:^{ // Tabbar index [[NSNotificationCenter defaultCenter] postNotificationName:@"ShareArray" object:_selectedimgarray]; [[NSNotificationCenter defaultCenter] postNotificationName:@"SharetitleArray" object:_newtile]; [[NSNotificationCenter defaultCenter] postNotificationName:@"sharevideooutputurl" object:_finalvideourl]; }]; 在1stVC中,我正在像这样检索它们 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedArray:) name:@"ShareArray" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedtitleArray:) name:@"SharetitleArray" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sharevideooutputurl:) name:@"Sharevideourl" object:nil]; – (void)receivedArray 🙁 NSNotification *)notification { NSMutableArray* userInfo = notification.object; UIImage […]