Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vimeo videos not playing on iPad UIWebView

Ok so I've looked around at the majority of other problems people are getting with vimeo and I don't think they've hit upon the same issue I've been getting.

When I open up a vimeo video on the Safari app on both my iPhone and iPad, they both work fine no problems.

Now I have created an iPhone app which has a UIWebView and loads a vimeo player video and that works fine too.

The issue is if I now install the same app on my iPad, the vimeo player refuses to load the video, it just hangs and the spinner keeps on spinning but the video won't load.

However, now what I did after that was create a basic app which loads a vimeo player URL in a UIWebView as a native iPad app, not an iPhone app which is resized or "2x" to fit an iPad. Surprisingly, this worked fine.

So now I'm confused... why is it that the iPad will not play the vimeo video if it's not running an app designed for the iPad? Is there some special magic going on behind the scenes which might break this?

I'm at a loss here, any help would be appreciated

like image 423
Jason Avatar asked Apr 27 '12 13:04

Jason


People also ask

Why are my Vimeo videos not playing?

Browser cache that has not been cleared and browser that is old and outdated. If your browser is not updated and you have an older browser you could face problems watching Vimeo videos.

Why won't some videos play on my iPad?

Outdated software or video player If you haven't updated your iPad's OS with the latest version, it can cause problems in playing videos. You should also update video apps, like YouTube and iTunes, on your iPad regularly for smooth operation.

How do I fix Vimeo not working?

1] Clear your browser cache and try again. You can do this via Settings > More Tools > Clear browsing data. 2] Open Chrome > Settings > Advanced settings > System. Toggle Use hardware acceleration when available to the Off position.


2 Answers

Implement the delegate method : shouldStartLoadWithRequest then in that method just detect that whether the requested URL is of type VIDEO if it is then please follow the code given in below link which worked for me :

Playing a video file from server in an Iphone app

This will be good in playing any video.

like image 115
DShah Avatar answered Oct 24 '22 23:10

DShah


The problem is likely with the user agent which is different from Safari's one on Apple devices: UIWebView sends some invalid string causing Vimeo (and sometimes YouTube) to break.

Luckly, you are allowed to override app's user agent using the following (C#, let me know if not clean enough):

NSDictionary dictionary = NSDictionary.FromObjectAndKey(new NSString("Mozilla/5.0 (" + (UIDevice.CurrentDevice.Model.Contains("iPad") ? "iPad" : "iPhone" ) +  "; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25"), new NSString("UserAgent"));
NSUserDefaults.StandardUserDefaults.RegisterDefaults(dictionary);

This makes the videos play just fine.

like image 39
Anton Avatar answered Oct 24 '22 22:10

Anton