Initial commit for OSX ANE is here. More to come. And don't ask about Windows version
GitHub - tuarua/WebViewANE: Adobe Air Native Extension for embedding WKWebView on OSX
Initial commit for OSX ANE is here. More to come. And don't ask about Windows version
GitHub - tuarua/WebViewANE: Adobe Air Native Extension for embedding WKWebView on OSX
Swift is making it easy for you to make ANE huh?
I certainly wouldn't say "easy"
What has helped is the groundwork I did in creating the helper to convert FREObjects to Swift equivalents and back.
What was straightforward was getting the reference to the AIR window, creating a webView and adding it as a subview. That was about 10 lines of code.
Things that take a while to get used to are conditionals and unwrapping. Oh, and the Swift language changing all the time.
Overcame some hurdles with CEF on Windows.
So should have something by next weekend, based on WPF version of CefSharp.
OSX will still use WKWebView as it's faster
Oh man, I truly hope u can get something working for Windows... that'd be amazing. I've been looking for a decent Windows WebView ANE forever.
I do have Chrome Embedded Framework working, running websites inside an AIR app. I can navigate around, load urls.
I've completed most of the hooks going IN (eg load() reload() zoom() goBack() goForward() evaluateJavaScript())
I still need to implement the events OUT so that you can listen in as3 (eg onInitialized, onLoaded, onAddressChange)
I will upload to Github when it's in a usable state.
Performance is goodish. It seems the WPF version of CefSharp uses OSR (Offscreen rendering) which makes it a little more janky than the native version.
But it's a start....
"goodish" performance means better than the emulated IE11 engine in Windows when using the StageWebView( true ) ?
Running a 3d OpenGL scene into it gives me 5/10FPS
@tuarua, amazing work with the WebView ANE dude, work perfectly on OSX... SUPER useful!
I'm kinda desperate for the Windows version now!!!! I do mostly Window apps that require a proper web engine to work smoothly... I truly hope u can get something working on that platform as well
btw, a resize method is really useful... instead of reinit. But i can't find any in the documentation
myWebView = WKWebView(frame: myRect, configuration: configuration)
Hi @rodrigo
Windows version has just dropped!
https://github.com/tuarua/WebViewANE
re: WebGL. Please see note I put in the README. You won't get 60fps I'm afraid. I ran some samples from three.js and got maybe 30. It's down to how CefSharp WPF renders the view. Apparently the WinForms version is more performant but has issues with keyboard access.
Investigating the WinForms flavour will go on my list.
Thanks for your suggestion. Yes I realised earlier I should have a resize + reposition method. Know how in Windows, need to check OSX. On my TODO list.
One large thing missing is 2 way JS binding. That is allowing pages to callback to AIR.
I want to tackle that part next.
Oh and even if this ANE is not of use to people, it's worth checking the source code.
It was a great learning experience and shows how to render native widgets into Desktop AIR
I'm gonna check it now... can't wait to see more progress/features!
+1 to resizing!
Let me know if it runs without hitch. Always a bit nervous when there are dependancy dlls + frameworks involved.
Yep, agree... I hate testing in Windows
Dude, if u are able to get a working/stable solution for both desktop platforms... it'll be one of the best ANE developments ever created. I think we all are so tired of looking for hacks and workaround to get our desktop apps working, and the StageWebView implementation is so poor, with so many bugs and opened tickets in Adobe, and they just don't care ... wow, u have no idea how huge this is, at least to me
Just... thanks for bringing back hope, and I really hope u keep moving forward with this ANE.
So far, I just found the position bug in Windows. x is not considered, I created a ticket in ur repo.
Another strange thing that happened to me (Macbook 15" retina, using VM with Windows) is the actual pixel size of the WebView, seems 1/2 the size of the stage, so it doesn't take into account the AIR scaling factor or the current OS display resolution. Not a big deal, but I guess it could be consistent with OSX.
The performance on the Starling side with all the testings I did, is steady at 60FPS.
WebGL on Windows, as u said, is not supported by default, unless Settings::cef.bestPerformance=false. Making a simple test though, it renders this 3d scene super choppy (slow), but it shows constant 60FPS on the HTML monitor and doesn't seem to affect the Starling's performance either, idk why.
All the target="_blank" links that u click, opens a new window, which seems weird, but i don't mind...
Overall, for most HTML5 usage, the rendering and performance is really good on both platforms, you can definitely tell the difference with StageWebView
Thanks so much for the ANE, and keep the good work!
Please @tuarua, make position/resizing the top priority if possible.
@rodrigo
I've added a new method. I did the same time as fixing the .x issue
setPositionAndSize(x:int = 0, y:int = 0, width:int = 0, height:int = 0)
width and height are optional. Helps with setting the correct SetWindowPos() values in Windows
I'll comment on your other stuff tomorrow
U found an implementation for OSX to position/resize ?!
Yes,
WkWebView extends NSView
myWebView?.setFrameOrigin(NSPoint.init(x: _x, y: realY))
myWebView?.setFrameSize(NSSize.init(width: _width, height: _height))
Haha, I looked myself in stackoverflow/google and saw some references to NSView as well, couldn't make sense out of it with the responses though.
Good job sir!!!
JS bridge integration now? what's next?
1) Implement loadFileURL method on Windows version
2) Allow 2 way Javascript Binding between AIR and the webView
Idk about the used web engines, but we can basically "load" mp4 videos, PDFs files... or other filetypes that AIR can't handle?
On OSX the resizing works pretty well... Is not 100% accurate with the coordinates I pass while I resize the window, seems like it has a tiny delay to apply them, but I'm sure that's an OS thing, not ur ANE code.
Anyway, to "improve the UX" (I'm building a desktop app), I removeFromStage() while resizing, and after 0.25secs of no resize being active, I addToStage() again. Works beautifully
I realized, as I did this, that a "snapshot" bitmap, would be super handy!
Just a suggestion, u already did a great job @tuarua.
UPDATE: Damn, just realized it doesn't work on fullscreen (kinda a deal breaker to me) I guess AIR don't use the NSView.
The delay will be the OS.
Doesn't work as in webView disappears or AIR blows up?
It might be Stage3D context get's removed and readded and so it now ends up above the webView. As a quick test can you go fullscreen first and then init the webView?
UPDATE - Windows is fine, just ran a quick test with <systemChrome>none</systemChrome> and
WebViewANESample.target.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
WebViewANESample.target.stage.fullScreenSourceRect = new Rectangle(0,0,appWidth,appHeight);
Perhaps I misunderstand, Do you mean the webView doesn't work in fullscreen or setPositionAndSize() doesn't work in fullscreen ?
WebView doesn't render in fullscreen.... even if I call init() while in fullscreen mode.
If i leave the fullscreen it renders normally.
This happens on OSX, did not try it on Windows yet.
ok, I'll have a look
The OSX fullscreen issue should be fixed.
AIR uses a different window for it's Fullscreen mode, so I needed to swap the WKWebView into it's contentView
You'll need to notify the webview when Fullscreen state changes eg.
stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenEvent); ... private function onFullScreenEvent(event:FullScreenEvent):void { webView.onFullScreen(event.fullScreen); webView.setPositionAndSize(0, 90, _appWidth, _appHeight-140); }
Example is updated with fullscreen ability
mmm, I'm testing the updated ANE, without any code changes on my end, and is working without adding webView.onFullScreen(event.fullScreen); ...
Btw, I'm dealing with fullscreen and webview resize separately.
So, when the Webview is invisible/closed [ ::removeFromStage() ], and it receives the fullscreen event [ webView::onFullScreen( fullscreen ) ], it's been re-attached to the screen , not a big deal though, as I keep track of when is "open"/"close", so I'm using a condition for that, or I can remove the fullscreen event... just to let u know.
Do u know if it works on Windows the same way?
Bummer, on Windows:
[ErrorLogger] ERROR = 15-01-17 19:51:52.25 :: [UNCAUGHT] ArgumentError ArgumentError: Error #3500: The extension context does not have a method with the name setPositionAndSize. at flash.external::ExtensionContext/_call() at flash.external::ExtensionContext/call() at com.tuarua::WebViewANE/setPositionAndSize()[/Users/User/flash/WebViewANE/native_extension/src/com/tuarua/WebViewANE.as:115]
Ah, I may have missed a dll for the Win version.
Will update tonight.
You must log in to post.