Reputation: 1263
i trying to embed Video from youtube and vimeo, at the Moment i do the following:
if([item.source isEqual: @"youtube"])
{
UIView *videoContainerView = [[UIView alloc]initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)];
XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:item.videoId];
[videoPlayerViewController presentInView:videoContainerView];
[videoPlayerViewController.moviePlayer play];
videoPlayerViewController.moviePlayer.shouldAutoplay = NO;
[self addSubview:videoContainerView];
} else if ([item.source isEqual:@"vimeo"]) {
[YTVimeoExtractor fetchVideoURLFromURL:item.url quality:YTVimeoVideoQualityMedium completionHandler:^(NSURL *videoURL, NSError *error, YTVimeoVideoQuality quality) {
if (error) {
NSLog(@"Error : %@", [error localizedDescription]);
} else if (videoURL) {
NSLog(@"Extracted url : %@", [videoURL absoluteString]);
self.playerView = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[self.playerView.view setFrame:CGRectMake(0, 0, 320, 320)];
self.playerView.view.backgroundColor = [UIColor grayColor];
[self addSubview:self.playerView.view];
}
}];
}
For youtube Videos im using the XCDYouTubeVideoPlayerViewController, and for Vimeo i´m using YTVimeoExtractor. Now i have two Problems
First Problem:
The youtube Part works like charm, but the Vimeo part doesn´t work. From my webserver i get the following url:
http://vimeo.com/85004906
and after the url gets extracted by the YTVimeoExtractor i have the following snippet:
http://pdl.vimeocdn.com/85824/823/226049076.mp4?token2=1393842513_dd8e4d573f67656c80b91b3130d42824&aksessionid=ac7102b713f0b2c0
This is the videoUrl which i set into the MPMoviePlayerViewController. But i only get some gray background frame an no video is shown at all
Second Problem:
Apples doc says: If your app delivers video over cellular networks, and the video exceeds either 10 minutes duration or 5 MB of data in a five minute period, you are required to use HTTP Live Streaming.
So if i´m not using this, my app will get rejected? And if i have to use http streaming i have to do a extra part for HD Video?
Thanks!
Upvotes: 1
Views: 835
Reputation: 1570
I checked YTVimeoExtractor
& it uses a correct technique to extract vimeo videos, and the above url seems correct.
I am not sure why the MPMoviePlayerViewController
isn't playing the video, but I recommend trying to play it using AVPlayer
(It isn't as simple as MPMoviePlayerViewController
but it is more powerful) & check if you get the same result.
Regarding the 5MB limit, you don't have to worry about it, your app will get approved :)
Upvotes: 1