Reputation: 529
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
Upvotes: 9
Views: 3721
Reputation: 2483
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.
Upvotes: 1
Reputation: 9866
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.
Upvotes: 1