So I’m working on a VR app in csharp and I need to either open multiple offscreen browsers, which i have tried to do by instantiating this class:
public class Browser {
public ChromiumWebBrowser browserInstance;
public string Url { get => browserInstance == null ? url : browserInstance.Address; set { url = value; if (browserInstance != null) browserInstance.LoadUrl(url); } }
private string url;
public Browser(string url) {
Url = url;
#if ANYCPU
CefRuntime.SubscribeAnyCpuAssemblyResolver();
#endif
Init();
}
public async Task Init() {
CefSettings settings = new CefSettings {
UserAgent = "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Mobile Safari/537.36",
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\Cache")
};
await Cef.InitializeAsync(settings, performDependencyCheck : true, browserProcessHandler : null);
browserInstance = new ChromiumWebBrowser(Url);
await browserInstance.WaitForInitialLoadAsync();
}
// this is used to paint the browser on a texture elsewhere in the project
public void BindPaintEvent(EventHandler<OnPaintEventArgs> action) {
browserInstance.Paint += action;
}
}
When I do so, the ChromiumBrowsers do not initialize, I read somewhere that this was because there can only be a single instance of a Chromium Browser per App.
So what I am now trying to do is to open multiple tabs of this one browser and paint each of them individually.
But I can’t seem to find how to do that… What do you think I could do?
(Yes I have done my research, no I haven’t found anything relevant to my issue)
Thank you!
When I do so, the ChromiumBrowser do not initialize, I read somewhere that this was because there can only be a single instance of a Chromium Browser per App.
So what I am now trying to do is to open multiple tabs of this one browser and paint each of them individually.
But I can’t seem to find how to do that… What do you think I could do?
(Yes I have done my research, no I haven’t found anything relevant to my issue)
Thank you!