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...
"Choose Test.zip" 文件正是一个专注于验证码实现的项目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 ...
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 ...
Instructions in a computer system can be categorized into four main types. These include data transfers between memory and processor registers, arithmetic and logic operations on data, program ...
•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 ...
- **Increase in Levels in Line Coding Scheme**: The statement "An increase in the number of levels used in a line coding scheme increases the baud rate" is **False**. In fact, increasing the number of...
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 ...