IOS: Vimeo Video Player

I am trying to play a Vimeo video in 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 it works sometimes fine, but in other cases, the answer from Vimeo Player looks like this:

Vimeo response

Can someone tell me how to play Vimeo video in iOS on all devices?

EDIT1:

I tested User Agent information, and both devices (iPhone 4 and iPhone 3GS) send the same User Agent:

Mozilla / 5.0 (iPhone, iPhone 5 OS OS 5_0_1, like Mac OS X) AppleWebKit / 534.46 (KHTML, like Gecko) Mobile / 9A405

Next, I tried to play the video from the Safari browser on the iPhone 3GS, which gives the same error as in UIWebView.

+4
source share
2 answers

Only a few supported H.264 formats are supported, supported by 3gs. This shows that it is possible to video in H.264 format, which may not play on 3gs, and throw this specific error. (see 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 with Vimeo, and sometimes not? I do not know. My guess would be that they throttle their contents - or even change the H.264 format - depending on the bandwidth. Therefore, I will conduct several tests to find out which H.264 format will be received in your 3G and 4, and post the results here if there is anything interesting.

+1
source

Web requests made from UIWebView will not contain the word β€œSafari” in the User Agent string, so Vimeo may not be able to determine which of the mobile browsers and get the correct video format.

You can try replacing the UIWebView user agent with Mobile Safari one: here , you will find how to change it (or just Google). If you want, you can also read this article , very interesting information about how User Agent works in UIWebView and Mobile Safari.

+1
source

Source: https://habr.com/ru/post/1386309/


All Articles