开发者

Embedding BandCamp player in UIWebView?

I'm trying to embed a bandcamp music player into my app. Although their players are generally Flash-based, they are HTML5 when loaded in iOS mobile Safari. Trouble is, it only seems to work in mobile Safari itself... when I try to embed a player in a UIWebView, it tells me my browser is unsupported. Is there any way around this or am I hosed?

Example URL (obtained from th开发者_如何学运维e "Share" button on any bandcamp player): http://bandcamp.com/EmbeddedPlayer/album=355390343/size=grande3/bgcol=000000/linkcol=1275c4/


This is, because the user agent the UIWebView sends by default is another one than the one MobileSafari uses. The default is WebApps/1.0 CFNetwork/339.3 Darwin/9.4.1 and the one used by MobileSafari Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3

You can change the user agent sent by using the method

- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field

Take a look at the documentation to find out more.

This should solve your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜