gpt4 book ai didi

ios - iOS解析视频的json

转载 作者:行者123 更新时间:2023-11-28 17:42:29 32 4
gpt4 key购买 nike

我有一个视频文件存储在 json 中(在 URL 中),需要 jsonp 解析请求才能播放,我需要在 iPad 应用程序中执行此操作。我不知道从哪里开始,我知道如何用 json 解析数据。但我需要弄清楚如何解析视频,然后在应用程序中播放它。

谢谢!编辑:这就是你们的意思吗:

SBJSON *json = [[SBJSON new] autorelease];

MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[json objectWithString:responseString ]];
//NSArray *luckyNumbers = [json objectWithString:responseString error:&error];
[responseString release];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
//---play partial screen---
player.view.frame = CGRectMake(0, 0, 200, 200);
[self.view addSubview:player.view];


//---play movie---
[player play];

最佳答案

使用任何 JSON 解析器(如 JSONkit、YAJL、TouchJSON)解析视频 URL 的 JSON 数据。然后使用 NSURLConnection 委托(delegate)方法下载该视频并写入磁盘,或者您可以使用 ASIHTTP。然后使用 MPMoviePlayerController 播放下载的视频。

关于ios - iOS解析视频的json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7573242/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com