Reputation: 14934
I'm trying to play a Vimeo video in a iOS UIWebView using this code:
NSString *urlString = [NSString stringWithFormat:@"http://player.vimeo.com/video/%@?title=0&byline=0&portrait=0", video.serviceId];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
It works fine on iPhone 4 but on iPhone 3GS this works sometimes fine, but other times the response from the Vimeo Player is as following:
Can anybody tell me how to play a Vimeo video in iOS on all devices?
EDIT1:
I've tested the User Agent information and both devices (iPhone 4 and iPhone 3GS) is sending the same User Agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A405
Further I've tried to play the video from the Safari browser on the iPhone 3GS, which gives the same error as in the UIWebView.
Upvotes: 4
Views: 2964
Reputation: 1623
Web requests made from UIWebView will not include the word "Safari" in the User Agent string so, maybe, Vimeo cannot determinate which mobile browser is and retrieve the correct video format.
You could try to replace the UIWebView's User Agent with Mobile Safari's one: here you find how to change it (or just google it). If you want you could also read this article very interesting about how the User Agent in UIWebView and Mobile Safari works.
Upvotes: 1
Reputation: 2649
There are only a few supported formats of H.264 supported by the 3gs. This shows that it is possible to have videos in H.264 format that may not play on the 3gs, and throw that particular error. (cf., http://www.clone2go.com/tutorials/convert-dvd-movie-to-iphone-3gs.php and http://www.niallkennedy.com/blog/2010/07/h264-video.html)
But why does it sometimes work from Vimeo, and sometimes not? Dunno. My guesses would be in the idea that they throttle their content -- or even change the H.264 format -- depending on bandwidth. So I would run some tests to find out exactly what H.264 format is being received on your 3Gs and 4, and post the results here, if there is anything interesting.
Upvotes: 1