Reputation: 187
i am streaming videos in my iphone app and i want to know that the video can be played on the simulator and can also be shown as the thumbnail images as in photo gallery. And what is the good practicing to play videos..
Upvotes: 0
Views: 675
Reputation: 1205
Here is the code for youtube video stream
- (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];
}
Upvotes: 1
Reputation: 13180
Yes it is possible.
for that you have to use mpmovieplayercontroller.
this link should help you.
Upvotes: 1
Reputation: 3402
Hello shivangi,
You will try this its help you.
http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html
Upvotes: 0