Bigbluebutton 官网文档:http://docs.bigbluebutton.org/
官方建议PC和手机使用Chrome或者Firefox、safari浏览器打开网页就可以使用。
问题:现在开发APP当中,用iOS、安卓内核的浏览器(Webview)打开网页会提示版本太低。但是手机浏览器是可以正常使用 。
IOS上面从safari11开始也提供webrtc支持了。全部用浏览器打开就好了。包括iOS 用SFSafariViewController打开也是可以支持的,但是用webview或者wkwebView打开会提示版本不支持建议用浏览器打开的提示;包括安卓的webview也是有相同问题;
iOS和安卓的解决办法:
iOS端 (wkwebView方式):
- (void)setupWKWebView{
UIButton *clickBtn = [[UIButton alloc] initWithFrame:CGRectMake(150, 250, 100, 50)];
clickBtn.backgroundColor = [UIColor yellowColor];
[clickBtn setTitle:@"点击WKWeb打开" forState:UIControlStateNormal];
clickBtn.titleLabel.textColor = [UIColor blueColor];
[clickBtn addTarget:self action:@selector(clickWKW:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:clickBtn];
WKWebViewConfiguration *webConfiguration = [WKWebViewConfiguration new];
_webView = [[WKWebView alloc] initWithFrame:[UIScreen mainScreen].bounds configuration:webConfiguration];
_webView.UIDelegate = self;
_webView.navigationDelegate = self;
[self.view addSubview:_webView];
_webView.backgroundColor = [UIColor yellowColor];
//修改agent-serve 关键点!!!
NSString *ua = [NSString stringWithFormat:@"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"];
if (@available(iOS 12.0, *)){
//由于iOS12的UA改为异步,所以不管在js还是客户端第一次加载都获取不到,所以此时需要先设置好再去获取
NSString *userAgent = [_webView valueForKey:@"applicationNameForUserAgent"];
NSLog(@"old-agent serve:%@",userAgent);
NSString *newUserAgent = [NSString stringWithFormat:@"%@%@",userAgent,ua];
NSLog(@"new-agent serve:%@",newUserAgent);
[_webView setValue:newUserAgent forKey:@"applicationNameForUserAgent"];
}
[_webView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id _Nullable result, NSError * _Nullable error) {
NSString *userAgent = result;
if ([userAgent rangeOfString:ua].location != NSNotFound) {
return ;
}
NSString *newUserAgent = [userAgent stringByAppendingString:ua];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:newUserAgent,@"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
[[NSUserDefaults standardUserDefaults] synchronize];
//不添加以下代码则只是在本地更改UA,网页并未同步更改
if (@available(iOS 9.0, *)) {
[self->_webView setCustomUserAgent:newUserAgent];
} else {
[self->_webView setValue:newUserAgent forKey:@"applicationNameForUserAgent"];
}
}];
//加载请求必须同步在设置UA的后面
NSURL *url = [NSURL URLWithString:_pathUrl];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
[_webView loadRequest:request];
}
安卓端(webview):
安卓代码加下面的内容(似乎是将浏览器定义成PC浏览器来使用)
WebSettings settings = webView.getSettings();
settings.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36");