4

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:

Vimeo response

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.

dhrm
  • 14,335
  • 34
  • 117
  • 183
  • 1
    I *think* some videos on Vimeo are not compatible because they're not encoded using compatible settings for iOS. – mattjgalloway Dec 14 '11 at 12:02
  • Well, the same video can something give the above screen and other times it is working fine. – dhrm Dec 14 '11 at 13:22

2 Answers2

1

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.

iND
  • 2,663
  • 1
  • 16
  • 36
1

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.

Community
  • 1
  • 1
Sylter
  • 1,622
  • 13
  • 26
  • Uhm... Could you please post the link of a video that presents this problem? I think that matter is in the different H.264 encoding (as suggested by **iND**): the one supported by iPhone 3GS is _Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps_ and by iPhone 4 is _Main Profile level 3.1 with AAC-LC audio up to 160 Kbps_: with the link we can check which version is used and understand something more about this (strange) problem. – Sylter Jan 08 '12 at 18:22
  • This video is working fine on both devices: http://player.vimeo.com/video/28277286 – dhrm Jan 08 '12 at 20:37
  • Today I've checked the videos, but both seem perfect for iPhone 3GS/4. I really don't understand why they behave in this strange way. I used _MediaInfo_ and _VideoSpec_ to analyze, but the only difference is in the audio bitrate... You could run some tests to understand which format receive the app from Vimeo, maybe we will discover something useful... – Sylter Jan 09 '12 at 19:20
  • Thanks for your research. Do you have a 3GS device, on which you have tried to play the above video? I have only tested on one 3GS device -- maybe this device is malfunction. – dhrm Jan 09 '12 at 21:24
  • No, for development I have only 4 and 4S, but a friend of mine has got one: tomorrow I am going to try on his device and post my results. This problem arouses my curiosity, I need to understand more about it... – Sylter Jan 09 '12 at 21:48
  • News: I tried with a 3GS and I got the same (mis)behavior you described. Still searching an answer... – Sylter Jan 10 '12 at 19:35
  • I guess you didn't find a solution to this problem. Thanks for your time anyway! – dhrm Feb 29 '12 at 13:26
  • Hi @DennisMadsen, I don't suppose you ever found a solution to this did you? – Jamie Taylor Sep 12 '13 at 10:24