简体   繁体   English

如何从.3gp类型的URL播放视频文件

[英]How to play a video file from the URL of type .3gp

Thanks in advance. 提前致谢。 I want to implement the code to play a video in iphone programatically from URL. 我想实现代码以从URL以编程方式在iPhone中播放视频。 I have written the code like this . 我已经写了这样的代码。

 NSURL *url = [NSURL    URLWithString:@"http://91.220.127.40/Celebrity_subCategoryItems/rc4.3gp"];//@"http://www.businessfactors.de/bfcms/images/stories/videos/defaultscreenvideos.mp4"];
MPMoviePlayerController *player =[[MPMoviePlayerController alloc] initWithContentURL:     url];
[[player view] setFrame: [self.view bounds]];  // frame must match parent view
[self.view addSubview: [player view]];
[player play];

but it is not playing the file of type .3gp. 但它没有播放.3gp类型的文件。 If any one know please help me. 如果有人知道,请帮助我。

I have played successfully .3gp with iphone sdk and my code is : 我已经使用iphone sdk成功播放了.3gp,我的代码是:

NSString *soundLocalPath  = [[NSBundle mainBundle] pathForResource:@"Demo_video" ofType:@"3gp"];

NSURL *tempUrl   = [NSURL fileURLWithPath:soundLocalPath];

self.soundUrlPath = tempUrl;

MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: self.soundUrlPath];

self.mpMoviePlayer = player;

[player release];

[self.mpMoviePlayer prepareToPlay];
[self.mpMoviePlayer.view setFrame: self.view.bounds];  // player's frame must match parent's

[self.view addSubview: self.mpMoviePlayer.view];

[self.mpMoviePlayer play];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(movieFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:player];


-(void) movieFinishedCallback:(NSNotification*) aNotification
{
    MPMoviePlayerController *player = [aNotification object];

    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:MPMoviePlayerPlaybackDidFinishNotification
                                                  object:player];

    [player autorelease];
}

We can also able to play files with .3gp extension, but to play we need some compression standards for that converted the file into all mobile supported formats means (3GPP - Mobile Balanced Quality [H.263 near 128 kbps, 10 fps, 128*96; AMR)). 我们还可以播放扩展名为.3gp的文件,但要播放该文件,我们需要一些压缩标准,以便将文件转换为所有移动支持的格式(3GPP-移动平衡质量[H.263,接近128 kbps,10 fps,128 * 96; AMR))。 So it is playing now. 所以现在正在播放。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM