I was in a UIViewControl template add two buttons: Play a click after the implementation of the local code, and the other to perform remote video code.
1 local video playback: can play mp4, but can not play 3gp format (MP4 and 3gp corresponding resource files have been added to the resource where I'm sure): the phenomenon is executed after play, the system immediately behind the callback I registered finishCallback.
2 Play Remote Video: not successful, the system immediately callback I registered finishCallback.
My code is as follows (just started learning IOS, prawns fast Manga, :)):
- (IBAction) playUrlVideo / / button is clicked the remote player code execution here
{
NSString * url = @ "http://www.itc.virginia.edu/network/videotest/when-lg.mov";
isUrl = YES;
[Self playerRun: url];
}
- (IBAction) playFileVideo / / button click to perform a local player code here
{
NSString * url = [[NSBundle mainBundle] pathForResource: @ "cv" ofType: @ "mp4"];
isUrl = NO;
[Self playerRun: url];
}
- (Void) playerRun: (NSString *) url
{
NSURL * urlPath;
if (isUrl) {
urlPath = [[NSURL alloc] initWithString: url];
}
else {
urlPath = [[NSURL alloc] initFileURLWithPath: url];
}
MPMoviePlayerViewController * pc = [[MPMoviePlayerViewController alloc] initWithContentURL: urlPath];
self.player = pc;
[Pc release];
/ / Add view.
[Self.view addSubview: player.view];
/ / Set animation.
[Self presentMoviePlayerViewControllerAnimated: player];
/ / Set config and start playing.
player.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
player.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
[Player.moviePlayer play];
/ / Callback
[[NSNotificationCenter defaultCenter] addObserver: self selector: @ selector (playCallback :) name: MPMoviePlayerPlaybackDidFinishNotification object: nil];
[UrlPath release];
}
- (Void) playCallback: (NSNotification *) notification
{
NSError * error = [[notification userInfo] objectForKey: @ "error"];
if (error) {
/ / There is no coming
NSLog (@ "DidFinishNotification has error% @", error);
}
[[NSNotificationCenter defaultCenter] removeObserver: self name: MPMoviePlayerPlaybackDidFinishNotification object: nil];
if (player) {
[Self dismissMoviePlayerViewControllerAnimated];
[Player.moviePlayer stop];
player.moviePlayer.initialPlaybackTime = -1.0;
[Player release];
player = nil;
}
}
Reply:
I described the situation in the simulator and the performance of the phone are the same. xcode is 3.2.6, the system is mac os x 10.6.6
Reply:
Their top
Reply:
There are experts to help me see how it's going?
This is really just beginning to learn to understand ah
Reply:
Not done
http://developer.apple.com/library/ios/ # documentation / MediaPlayer / Reference / MPMoviePlayerController_Class / Reference / Reference.html
See the documentation it
Reply:
My code is now able to play mp4 local and remote mp4, 3gp format but can not play, the phenomenon is the play, the system will immediately call back to my registered MPMoviePlayerPlaybackDidFinishNotification callback (playCallback). For 3gp Is there any limitations?
Reply:
MPMoviePlayerViewController supports video formats: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1, using AAC-LC sound formats, the maximum 160 Kbps, 48kHz, stereo as m4v, mp4 and mov file formats; ..
MPEG-4 video up to 2.5 Mbps, 640 x 480, 30 frames per second, Simple Profile using AAC-LC sound formats, the maximum per channel 160 Kbps, 48 KHz, for the stereo. M4v,. Mp4 and. Mov file formats ;
Motion JPEG (M-JPEG) up to 35 Mbps, 1280 x 720, 30 frames per second, audio format to ulaw, PCM stereo is. Avi file format
Wood 3gp Yeah ⋯ ⋯

Reply:
Results posted: Code no problem on ios some 3gp format is not supported. I downloaded from 3g.youku.com in 3gp on the phone try to have passed. 3gp file is transferred by the original test tool from Youku flv to 3gp code, it is estimated there coding is different.
Ios it just started to learn to worship here, and we hope to be able to more exchanges :)
No comments:
Post a Comment