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

Iphone 如何从.3gp类型的URL播放视频文件,iphone,Iphone,提前谢谢。我想实现从URL在iphone中以编程方式播放视频的代码。我已经写了这样的代码 NSURL *url = [NSURL URLWithString:@"http://91.220.127.40/Celebrity_subCategoryItems/rc4.3gp"];//@"http://www.businessfactors.de/bfcms/images/stories/videos/defaultscreenvideos.mp4"]; MPMoviePlayerContr

提前谢谢。我想实现从URL在iphone中以编程方式播放视频的代码。我已经写了这样的代码

 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];

但它并没有播放.3gp类型的文件。如果有人知道,请帮助我。

我们也可以播放扩展名为.3gp的文件,但要播放,我们需要一些压缩标准,以便将文件转换为所有移动支持的格式(3GPP-移动平衡质量[H.263接近128 kbps,10 fps,128*96;AMR))因此,它现在正在播放。

我们也可以播放扩展名为.3gp的文件,但要播放,我们需要一些压缩标准,以便将文件转换为所有移动支持的格式(3GPP-移动平衡质量[H.263接近128 kbps,10 fps,128*96;AMR)).现在正在播放。

我已经成功播放了。3gp与iphone sdk配合使用,我的代码是:

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];
}

我已经用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];
}

苹果文档的哪一部分告诉你使用3GP文件?我直到现在才知道。在iphone中不可能使用3GP文件。好吧,3GP是一种稍微受限的MP4格式-因此它可能会工作,但通常不会。你选择的格式是用于渐进下载的MP4(M4V)或M3U8(HTTP视频流)对于适当的自适应流媒体。你应该真正查阅编写良好的苹果文档。苹果文档的哪一部分告诉你使用3GP文件?我直到现在才知道。在iphone中不可能使用3GP文件。3GP是一种稍微受限的MP4格式-因此它可能会工作,但通常不会。你选择的格式是MP4(M4V)用于渐进式下载,或M3U8(HTTP视频流)用于适当的自适应流媒体。您应该真正查阅编写良好的Apple文档。其中MPMoviePlayerController*mpMoviePlayer;@property(保留,非原子)MPMoviePlayerController*mpMoviePlayer;在.h文件中定义。其中MPMoviePlayerController*mpMoviePlayer;@property(保留,非原子)MPMoviePlayerController*mpMoviePlayer;是在.h file.hi@Vennela中定义的。您能告诉我如何以标准格式压缩此视频吗?提前谢谢hi@Vennela您能告诉我如何以标准格式压缩此视频吗?提前谢谢