【发布时间】:2011-11-08 18:36:30
【问题描述】:
我正在我的 iphone 应用程序中流式传输视频,我想知道视频可以在模拟器上播放,也可以显示为照片库中的缩略图。 还有什么是播放视频的好习惯..
【问题讨论】:
标签: iphone objective-c ios video
我正在我的 iphone 应用程序中流式传输视频,我想知道视频可以在模拟器上播放,也可以显示为照片库中的缩略图。 还有什么是播放视频的好习惯..
【问题讨论】:
标签: iphone objective-c ios video
是的,这是可能的。
为此,您必须使用 mpmovieplayercontroller。
此链接应该对您有所帮助。
【讨论】:
这是 youtube 视频流的代码
- (void)embedYouTube:(NSString*)url frame:(CGRect)frame {
NSString* embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString* html = [NSString stringWithFormat:embedHTML, url, frame.size.width, frame.size.height];
if(videoView == nil) {
videoView = [[UIWebView alloc] initWithFrame:frame];
[self.view addSubview:videoView];
}
[videoView loadHTMLString:html baseURL:nil];
}
【讨论】:
你好 shivangi,
You will try this its help you.
http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html
【讨论】: