我在我的iphone应用程序中播放视频,我想知道视频可以在模拟器上播放,也可以显示为相册中的缩略图。播放视频最好的练习是什么?
发布于 2011-08-20 15:44:21
你好,希万吉,
You will try this its help you.
http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html发布于 2011-08-20 15:47:04
这是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];
} 发布于 2011-08-20 15:48:12
是的,这是可能的。
为此,您必须使用mpmovieplayercontroller。
此链接应该会对您有所帮助。
https://stackoverflow.com/questions/7130464
复制相似问题