While playing a video using MPMoviePlayerViewController or MPMoviePlayerController, iOS SDK 5.2 generates an error as follows.
An AVPlayerItem can occupy only one position in a player’s queue at a time.
The exact error is as follows.
*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘An AVPlayerItem can occupy only one position in a player’s queue at a time.’
Please have a look into following code - WHICH GENERATES ERROR.
#pragma mark - Media player
-(void)initAndPlayMovie:(NSURL *)movieURL andViewController:(UIViewController*)vCtr {
self.mPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL]; // set source type streaming
[self.mPlayer.moviePlayer setMovieSourceType:MPMovieSourceTypeStreaming]; [self.mPlayer.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
// fit to screen mode
[self.mPlayer.moviePlayer setScalingMode:MPMovieScalingModeAspectFit];
// full screen mode
[self.mPlayer.moviePlayer setFullscreen:YES animated:YES];
[vCtr presentMoviePlayerViewControllerAnimated:self.mPlayer];
}
Now, have a look into following code WHICH WILL WORK FINE
#pragma mark - Media player
-(void)initAndPlayMovie:(NSURL *)movieURL andViewController:(UIViewController*)vCtr {
self.mPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
// set source type streaming
[self.mPlayer.moviePlayer setMovieSourceType:MPMovieSourceTypeUnknown]; [self.mPlayer.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
// fit to screen mode
[self.mPlayer.moviePlayer setScalingMode:MPMovieScalingModeAspectFit];
// full screen mode [self.mPlayer.moviePlayer setFullscreen:YES animated:YES];
[vCtr presentMoviePlayerViewControllerAnimated:self.mPlayer];
}
The main difference in both code is as follows.
MovieSourceType is modified to “MPMovieSourceTypeUnknown” instead of “MPMovieSourceTypeStreaming”.
If you have a streaming URL, It is recommended to use “MPMovieSourceTypeStreaming”.
While having a static movie URL, It is recommended to use “MPMovieSourceTypeUnknown”.
If you have a URL from file or video from application itself, It is recommended to use ”MPMovieSourceTypeFile”.
分享到:
相关推荐
* Only one piece can occupy any position on the board at a given time. * All pieces can “jump” any occupied position. Note: Although the game bears a striking resemblance to Chess, this is entirely...
项目的实现代码,提供了网站登录时的验证码实现DEMO,可以下载下来运行实现,
octets in the range 0x80 to 0xBF (128-191) can only appear in the second and subsequent octets of a multi-octet encoding. Remember that you cannot use \0 in a Lua pattern. For example, you could ...
An int type variable always occupy 4 bytes consecutively, so is an array of 4 char type elements. Write a function to convert an unsigned int type variable into an array of 4 char type elements.
• “Free 5GB SugarSync Account” button in the SugarSync connection parameters window lets you create a free new account in case if you haven't got one • PDF's Freehand drawing mode now lets you ...
3. Build up one’s confidence and offer one a sense of achievement (accomplishment), because one can realize his value and capability. 4. Learn to cooperate and master interpersonal skills, which are ...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a corrupt...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a corrupt...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a ...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a corrupt...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a ...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a corrupt...
Q433283 - A layout group with a label layout item that is set to occupy the entire client area of its group has an incorrect width B218895 - Documentation - Incorrect topic navigation due to a corrupt...
Quadrature amplitude modulation (QAM) is a modulation scheme in which two sinusoidal carriers, one exactly 90 degrees out of phase with respect to the other, are used to transmit data over a given ...
That is, the high word of a two-word address will always occupy the lower word of memory. ?Memory is 256 words. ?There are two accumulators, A and B, each storing one word. ?There are nine ...
•Q583166 - Restoring the tree list from an empty or corrupted store using RestoreFrom~ method calls assigns incorrect Coilumn.Position.BandIndex property values, and as a result, hides these columns ...
Big Data and IT Professionals: A Study of the Perceptions Held by IT Professionals in Relation to the Maturity, Value, and Practical Deployment of Big Data Solutions This work documents a research ...
date, however, no one has tested if LiDAR returns from water surfaces can be used to measure local water surface slopes within the active channel. Much of the reason that researchers have not ...
Extract, decrypt, parse, restructure – these are just some of the text tasks that can occupy much of a programmer’s life. If this is your life, this book will make it better – a practical guide on...
A Textbook of Java Programming By 作者: Surbhi Kakar ISBN-10 书号: 9385909665 ISBN-13 书号: 9789385909665 出版日期: 2017-12-18 pages 页数: 468 $35 This book covers all the core java concepts of ...