ZFBrowser Documentation
This asset allows you to embed a full copy of Chromium, the open-source core of Google Chrome, inside your game!
Product Page | Unity Asset Store | Changelog | Get Help
Documentation for ZFBrowser v3.1.0.
Uses CEF 74.1.19+gb62bacf+chromium-74.0.3729.157 / Chromium 74.0.3729.157.
Copyright © 2015-2019 Zen Fulcrum LLC
Quick Start
Basic Browser:
- If you are using Linux or OS X read the platform-specific notes.
- Import ZFBrowser into your project.
- Grab
ZFBrowser/Prefabs/Browser (Mouse)
and drop it into your scene. - On this new object, set the URL to a site of your choice, such as
https://google.com/
- Fiddle with your camera so the quad fills most of the view.
- Hit play and interact with the web site.
Embedded assets:
- Start with the scene above.
- Create a folder called
BrowserAssets
right next to (not inside!) yourAssets
folder. - Create a file called
index.html
insideBrowserAssets
and put this in it:<h1>Hello World!</h1>
- Set the URL for your browser to
localGame://index.html
- Hit play.
Congratulations! You now have a browser in your game!
See this section if you want to use the browser in VR.
General
Important Note
This library is made possible by a number of third-party open source software projects!
A copy of ThirdPartyNotices.txt needs to be distributed with your product. The build scripts copy it automatically.
Supported Platforms
This plugin is available for the given platforms and architectures:
- Windows Standalone, 32-bit (Mono) and 64-bit (Mono or il2cpp)
- Does not include WSA/UWP/HoloLens support.
- May not work if basic updates have not been installed. Windows XP is not supported.
- Linux Standalone, 64-bit (experimental) (Mono)
- The most recent Ubuntu LTS should work. Let me know if you find a mainstream, recent distro that has issues.
- Unity 2018.3.0, and probably certain other 2018.3.x versions, do not work. Try Unity 2018.3.8+.
- OS X Standalone, 64-bit (Mono or il2cpp)
- Does not include Mac App Store support
Except as noted, only building on the same platform as your target is supported. If you have troubles making a build or testing in the editor, try again with the Unity Editor running on your target platform.
This Asset does not include licenses for proprietary or patent-encumbered codecs such as h.264. (Most streaming sites use patent-encumbered codecs and will not work. YouTube videos generally work, unless they are live.) Consider re-encoding your content with an open codec supported by stock Chromium such as WebM or Ogg Vorbis.
OS X Users
- (Pre-Unity 2017.3) By default, your new Unity project will target universal builds, you'll need to change it to x64 before you can build and run your application.
- You can make OS X builds from Windows, but make sure that correct files are marked executable once they reach an OS X filesystem:
chmod +x MyGame.app/Contents/MacOS/MyGame MyGame.app/Contents/Frameworks/ZFGameBrowser.app/Contents/MacOS/ZFGameBrowser
Linux Users
- Linux support is experimental.
- You can make Linux builds from Windows, but make sure that correct files are marked executable once they reach a Linux filesystem:
chmod +x MyGame.x86_64 MyGame_Data/Plugins/ZFGameBrowser
- Newer versions of Ubuntu: You need to
sudo apt install libgconf2-4
as an installation dependency.
Other Platforms
ZFBrowser is only supported on the platforms listed above right now. If you're interested in support for other platforms, please let me know! In most cases I can't simply port the existing backend to another OS, but having your votes will help me know what is most worthwhile to work on!
Scripting
You can send and receive messages from the currently loaded browser page.
JavaScript vs UnityScript
Browsers run JavaScript, specifically, ECMAScript. JavaScript has a .js extension. Unity runs .NET languages, in particular: C# (.cs) and previously Boo (.boo) and UnityScript (.js). Due to a terrible historical mistake, UnityScript has been, and often still is, called "JavaScript". To be clear:
UnityScript IS NOT JavaScript.
In this package all references to "JavaScript" refer to what web browsers run. Beware that UnityScript and JavaScript files both have the same .js extension. In general, files in Assets/ with a .js extension will be treated as UnityScript and files in BrowserAssets/ with a .js extension will be treated as JavaScript.
Scripting Intro
Browsers have a Browser
MonoBehaviour. You can call functions in the page by invoking CallFunction
:
using ZenFulcrum.EmbeddedBrowser;
...
var browser = GetComponent<Browser>();//assuming we are a MonoBehaviour attached to the same GameObject as the Browser
//calls window.setPlayerStats("myPlayerName", 2, 4200, false) in the browser
browser.CallFunction("setPlayerStats", "myPlayerName", 2, 4200, false).Done();
Functions are resolved in the global scope of the top frame of the browser and executed with the given arguments. You can pass basic types (strings, integers, bools, etc.) without any extra effort.
You can also use EvalJS
to run any JavaScript you'd like in the context of the page:
browser.EvalJS("if (someCondition()) someVar = 42;").Done();
To query the page for data, you can look at the return value. EvalJS
and CallFunction
don't execute immediately, they are asynchronous, therefore they return promises:
browser.EvalJS("document.title").Then(ret => Debug.Log("Document title: " + ret)).Done();
browser.CallFunction("doSomeFoo", 1, 2, 3).Then(ret => Debug.Log("Result: " + ret)).Done();
If you are in a Unity coroutine, you can wait for the promises to finish before continuing:
var promise = browser.EvalJS("document.title");
yield return promise.ToWaitFor();
Debug.Log("Document title: " + promise.Value);
This can be much easier to deal with in cases where you are chaining a lot of tasks.
You'll typically want to add .Done()
after any EvalJS()
or CallFunction()
calls. This will add a default error handler that will log any unhandled exceptions or syntax errors in your code. You won't get errors for your evaluated code unless you call EvalJS(...).Done()
or otherwise use the Promise API to handle the error. If you don't call .Done()
, .Catch()
, or the like your code will still execute, you just won't be notified if it fails.
See the promise section for more details on the promise library.
To receive events pushed from the page, you can expose a function callback. Do this with RegisterFunction
:
browser.RegisterFunction("confirmClicked", args => Debug.Log("Button clicked: " + args[0] + " val: " + (int)args[1]));
Then you can call it from your page:
<!-- When this is clicked, Unity will log "Button clicked: button3 val: 13" -->
<button onclick="confirmClicked('button3', 13)">Confirm Things</button>
Notes
- The functions that return data from a page return a
JSONNode
. This is a class which implicitly converts to basic types like strings and integers. Take a look in JSONNode.cs for more information. - If you'd like to pass something more complex than a basic type, build a
JSONNode
. AJSONNode
allows you to build and access JSON data using a fairly fluent language-native interface. - If you'd like to pass something yet still more complex, or have data automatically read from your objects' fields:
- You can use any JSON system (such as Unity's functions, Json.NET/Newtonsoft.Json, or another library of your choice) to pack and unpack data on the Unity side.
- You can use JSON.stringify/parse on the JavaScript/browser side.
- You can also evaluate raw JavaScript in the browser by calling browser.EvalJS
- If the Browser isn't ready for commands or the page isn't loaded yet, it will queue your commands and execute them then the page is loaded.
- The JavaScript execution engine is V8. Not only is JavaScript support robust and complete, you can also use es6 features supported by the backing Chromium version.
- Note that functions you expose won't be available at the time of the HTML load event. If you need to know when the page loads, use browser.WhenLoaded (Unity side).
- Check out the included demo and examples for some example code and use cases.
- For pages that have Content Security Policies preventing use of eval ("Refused to execute inline script because it violates the following Content Security Policy ..."), use
EvalJSCSP
. There's pitfalls, so read the function's documentation.
Promises
ZFBrowser uses this promise library made by Real Serious Games with some small changes.
Original documentation can be found here or online here.
This copy has been modified a bit from the version you can get from GitHub, namely:
- The library namespace has been changed from
RSG
toZenFulcrum.EmbeddedBrowser
namespace for simplicity and to avoid potential conflicts. - An
UnhandledException
handler forDebug.LogError
is registered by default. - You can use Promises with coroutines:
yield return somePromise.ToWaitFor();
waits for the promise to be rejected or resolved. - You can query a Promise for its resolved value (or rejection) with
promise.Value
.
The promise library is covered by the MIT license, as noted in ThirdPartyNoticies.txt.
Embedded Resources
You can embed web resources (HTML, JS, CSS, images, etc.) with your game and access them without the need for an external web server.
Place these resources in a folder named BrowserAssets
next to your Assets
folder, then access them with localGame://index.html
instead of the usual http://example.com/index.html
.
Notes
localGame://
is treated like a unique domain and is subject to same-domain policies like other websites.- Remember: If you want to run scripts on arbitrary websites, you can open a browser to that website and inject JavaScript with browser.EvalJS.
- If you want to customize or change how these resources are fetched, read the documentation in WebResources.cs.
- In the editor, you can simply refresh a page to see updated changes for changed files.
- File names are case-sensitive! Test your standalone build. Under the Editor some platforms may incorrectly load wRonGcapS successfully.
- When you build, all browser assets are packaged up as a single file and included with the build.
localGame://
is not the actual URL the browser uses, so don't hardcode it in your HTML. (The real URL is currentlyhttps://game.local/
, but may change.)- Avoid putting untrusted code in BrowserAssets
- You may need to URL-encode your path if it contains non-alphanumeric characters. How to encode
Input
All mouse/keyboard input events are collected in Unity and forwarded to the underlying browser. How this input is sent can be customized.
- Out of the box, there are systems included for taking input from mouse, screen touches, camera ray (FPS), and tracked VR controllers. These input systems support browsers that are rendered either a) to a mesh (of any shape) with an appropriate mesh collider or b) Unity's GUI system.
- A few browser prefabs are included. Which one you use depends on what type of input you'd like:
- Have a mesh in a scene you click on with your regular mouse cursor? Use the
Browser (Mouse)
prefab. It uses aPointerUIMesh
that listens for mouse events and touch events and aCursorRendererOS
to change the ordinary mouse cursor to match the page. - Have a character walking around in a scene that interacts with browser "screens"? Use the
Browser (FPS)
prefab along with your character controller to use a camera's forward ray to point and the mouse to click. It calculates rays from the main (or your given) camera and uses aCursorRendererOverlay
to render the cursor in the middle of the game view. - Have a GUI of some sort? Take a
Browser (GUI)
and drop it into aCanvas
object. (It uses aCursorRendererOS
to change the mouse cursor.)- Consider setting the
Canvas
'sPixel Perfect
flag to true for a nicer-looking screen-space browser. - Note that the browser BG being transparent/opaque may affect font subpixel hinting.
- Consider setting the
- Want to point at the browser in VR with tracked controllers? Use the
Browser (VR)
prefab. VR needs some extra setup, keep reading here. (It uses aCursorRendererWorldSpace
to render the cursor in the game world.)
- Have a mesh in a scene you click on with your regular mouse cursor? Use the
- All input handlers above (except the GUI one) use a mesh collider and rays to determine where on the browser you are pointing. You can customize the shape of the mesh, but make sure the collider a) has the same mesh or b) a substantially similar mesh with UVs that visually align.
- A wide variety of mouse cursors are displayed on web pages to give context. The above prefabs should do what you need, but take a look at the
CursorRenderer*
classes if you are doing something by hand or want to play around. - At present, the all clicks/touches/pointing is converted to a single mouse click and sent to the browser as such. Unfortunately, that means touch scrolling/gestures aren't presently available. (But you might be able to workaround this by using EvalJS.)
- Mouse scroll speed and double-click handling options can be adjusted by altering myBrowserUI.InputSettings.
VR Input
An input system is included for getting input from tracked VR controllers to point at and interact with a browser. Unity 2017.2 or newer is required.
Unity's VR controller input is a bit of a mess right now (see comment in VRInput.cs). To get input data form the controllers we use the direct APIs, which may require some extra setup.
First, do the usual setup to get VR running in your project (Player Settings » XR Settings). Then follow the instructions for the VR backend you are using below. Then look at the rest of this section.
SteamVR
Using the SteamVR runtime (and OpenVR API). This is for the HTC Vive, Oculus under SteamVR, and pretty much everything else.
First:
- If you are using Unity 2018.3+: Install the OpenVR package (Window → Package Manager → OpenVR → Install)
Then you have a couple options:
- Option A: Using "hardcoded" input, SteamVR 1.x style. Fast+simple. Incompatible with SteamVR package and reduced controller support.
- Just...start using it. It should work right out of the box for a Vive wand or Oculus Touch.
- By default, trigger is left click, grip is right click, and you can use the touchpads/joysticks to scroll. Click the touchpad or joystick to middle click. Extend
VRBrowserHand
to adjust/remap the inputs.
or
- Option B: Using SteamVR 2.0+ and its remappable input system. Requires the SteamVR package.
- Open up
OpenVRConfig.cs
and change the mode toInputMode.MappedActions
. - Grab the SteamVR SDK and import it.
- SteamVR's Unity plugin has assorted bugs and issues so be prepared for some hitches.
- SteamVR should detect the action maps included with ZFBrowser and prompt you to import them.
- If you already have any actions defined DON'T IMPORT YET. Cancel the dialog repeatedly and close Unity.
- SteamVR Unity version 2.3.2 doesn't correctly import default action mappings when merging.
- Apply this patch, then reopen Unity and import the ZFBrowser bindings.
- If you don't have any actions defined you can import the ZFBrowser actions immediately.
- If you already have any actions defined DON'T IMPORT YET. Cancel the dialog repeatedly and close Unity.
- More:
- If pointing works but buttons don't then something isn't set up right. Things to check:
- Is
OpenVRConfig.mode
set toInputMode.MappedActions
? - The actions named in
OpenVRConfig.cs
must exist.PointPose
andLeftClickAction
are critical, the rest less so. - Is the action set active? (See below)
- Are mapping defined for your controller? Assuming the default inputs: In Unity go to Window → SteamVR Input → Open binding UI → Under
Current Binding
clickEdit
for your controller → select theui
tab- Make sure
Mirror Mode
is on. - Make sure something, usually a trigger, is bound as
Interact With UI
- Under
Edit Action Poses
make sureUI Pointer
is bound to the controller'sTip
.
- Make sure
- Is
- You don't have to use the provided actions, you can set the browser to use whatever input names you want in
OpenVRConfig.cs
.- You can also change, disable, or remap the inputs in this file.
- If SteamVR doesn't prompt you try opening the SteamVR Input window and regenerating the bindings.
- Default bindings are included for Vive wands and Oculus Touch.
- If you have more than one action set you need to enable the Browser's actions set (
ui
by default) before browser inputs will work. You can use aSteamVR_ActivateActionSetOnLoad
with theAction Set
set to\actions\ui
to enable it automatically.
- If pointing works but buttons don't then something isn't set up right. Things to check:
- Open up
Oculus VR
- If you are using Unity 2018.3+: Install the Oculus (Standalone) package (Window → Package Manager → Oculus (Standalone) → Install)
- Grab the Unity Oculus SDK and import it.
- In Unity go to Edit » Project Settings » Player » Other Settings » Scripting Define Symbols and add
OCULUS_API
to let ZFBrowser know to use it. (Or just uncomment#define OCULUS_SDK
in VRInput.cs.) - Delete
ZFBrowser/Scripts/**.asmdef
(2 files). - This isn't specific to ZFBrowser, but you may want to call
XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
somewhere to make the Oculus API use the right coordinate system (y=0 at the floor). By default it will put y=0 at standing eye height which is...weird.
Common
Once that's set up, you should be able to open up the VR
demo scene and give it a try! (Use the VR (SteamVR 2.0)
demo scene if you're using the SteamVR package with the new input system.)
To get things set up in your own scene:
- Start by dropping a
Browser (VR)
prefab into the scene. - Find the
VRBrowserHand
prefab and drop a couple into your scene next to your camera. (For SteamVR this would be just inside the[CameraRig]
prefab.) Use the inspector to assign one of them to the right hand. You can clear thevisualization
s if you don't want to use the default "laser pointer".- Make sure the
VRBrowserHand
s have the same transform parent as the VR camera. - Make sure the VR camera starts with no rotation at its local origin, or things may not line up!
- Make sure the
- Have at it!
Also:
- The default
Browser (VR)
prefab is set up to prevent accidental drags when clicking, which should make things a bit easier to interact with for those of us without surgeon hands. If you still find links hard to "click" on without holding your hand very still consider increasing the "Drag Movement Threshold" on the MeshPointerUI component. - Adding support for another VR backend might not be too much work. Take a look at
VRInput.cs
andVRBrowserHand.cs
to get a feel for what may need to happen.- Buttons and poses are read in the descendant classes of
VRInput
inVRInput.cs
.
- Buttons and poses are read in the descendant classes of
External Keyboard
A world space keyboard is included for use with VR text entry and other times when a regular keyboard is not available. It can be linked to a browser and keystrokes entered on the virtual keyboard are passed to the browser.
Open the demo named ExternalKeyboard
to try it out with your mouse!
This is mostly pure Qwerty layout without the top row. Modifiers have been swapped out for some shortcuts: select all text, undo/redo, and clipboard manipulation. There's some word-skipping buttons next to the arrows. You can also select characters/words by using shift followed by movement keys. There's also a few themes available. Click the ✩ where num lock would be to cycle through them.
You can customize the design of the keyboard, change the way a theme looks or which is the default, and even add or remove buttons. ZFBrowser/Resources/Browser/Keyboard.html
contains the HTML for the keyboard. ExternalKeyboard.cs
manages keyboard focus and typing/message routing.
To use it, drop the ExternalKeyboard
prefab into your scene. By default it will link up to whichever browser seems to be focused, but you can toggle this behavior in the inspector. Also, take a look at the VR
demo for an example.
Customization
- Customize
alert()
,prompt()
,beforeUnload
, and password dialogs and the context menu by editingZFBrowser/Resources/Browser/Dialogs.html
- Customize error pages by editing
ErrorGenerator.cs
- Hook these events by listening to
Browser.onLoadError
/onCertError
/onSadTab
.
- Hook these events by listening to
- Mouse cursors are:
- Stored in
ZFBrowser/Resources/Browser/Cursors.png
. (These are more-or-less the base Chromium icons.) - Loaded and managed by the
BrowserCursor
class. - To change how a current cursor looks without altering the size, just edit Cursors.png.
- If you wish to change the cursor sizes or which cursor types map to which Cursors.png item, take a look at IconGenerator.cs. (This script isn't intended for general use, so be prepared to get your hands dirty.)
- Stored in
Debugging
Page Debugging
Often during development, you will find your pages need debugging.
Tip: You don't always have to restart the game to test a change, in some cases you can simply refresh the page. (Unity inspector » browser instance » Refresh or Page inspector » ctrl+r).
Here's a few way to go about it:
Page Inspector
You can access the Webkit/Chromium inspector, which opens in a new window beside the running game.
- Under the Editor in play mode: Select the Browser, then click "Show Dev Tools"
- You can also use browser.ShowDevTools() to open an inspector window.
External Page Inspector
You can access the page inspector from another browser or IDE that supports Chromium's debugger.
- To debug when running in the Editor, visit http://localhost:9848/
- To debug when running a debug build, visit http://localhost:9849/
- Release builds cannot be debugged using this method.
- Use a Chromium-based browser to load the above URLs. (If you have issues, try using the same Chromium version as the ZFBrowser does.)
Ordinary Browser
You can also load your pages in an ordinary browser and debug them there. If you do, you may find it useful to create small "log what happened" stubs for the functions you expose from Unity. Call functions you want to test from the JavaScript console.
Cookies
By default cookies and profile data aren't saved between runs. Set BrowserNative.ProfilePath
to a folder of your choice before the first Update to enable profile saving. (Or use a BrowserSystemSettings
in your scene.)
- Delete all cookies with
browser.CookieManager.ClearAll()
. - Grab the cookies from the browser with
browser.CookieManager.GetCookies()
. This is asynchronous and returns a promise, see the promise section for more information on the promise library. - Once you have a cookie, you can make edits and call
cookie.Update()
or get rid of it withcookie.Delete()
. - Create new cookies from scratch with
new Cookie(browsser.CookieManager)
adjust the fields (be sure to set at least a domain, name, and value!) then create it withcookie.Update()
. - Aside from clearing all cookies, the Cookie API is a bit experimental, in particular, the dates may not function very well.
Notes
- You can customize which browser items the user is allowed to right-click (and get a context menu on). Look in the inspector under "Allow Context Menu On". By default, only text boxes will allow a context menu.
- Page background: By default, the
<body>
of pages will be rendered as transparent. You can change this to an opaque opaque color by setting the browser's Base Color to completely opaque. (If done from code, make sure to do this before the first Update() call.) Also, thisbaseColor
value is used to clear the browser texture until we have a page render (usually a brief flash).- This can't be fully changed after a browser is initialized, but you can change the page itself by runnings scripts. For example:
browser.EvalJS("document.body.style.background = 'red'")
- This can't be fully changed after a browser is initialized, but you can change the page itself by runnings scripts. For example:
- Custom mouse cursors are supported via CSS cursors.
- You can control what happens when navigation attempts to open a new window.
- Set the option you want in the inspector or call
browser.SetNewWindowHandler
. Ignore
will just ignore the new window.Redirect
, the default, will take the current window and send it to the new URL. (Note that some pop-up pages won't work if the parent is unloaded.)NewBrowser
allows you create a new in-game browser to hold the new "window". You need to write code and callbrowser.SetNewWindowHandler
for this option. Take a look at theNewWindow
demo!NewWindow
opens the browser in a new OS window. Don't use this except for testing and debugging. The OS-level windows may have unstable, unexpected, or incomplete behavior
- Set the option you want in the inspector or call
- We use a user agent that makes most websites think we're Chrome, but it does identify the engine, library, and your application's name and version. Change your application's name and version in the Player Settings.
- You can force your own user agent by calling
UserAgent.SetUserAgent(string)
. This must be called before the first browser initializes. - Save user data between application runs by setting
BrowserNative.ProfilePath
. Also must be called before the first browser initializes. - You can use a
BrowserSystemSettings
in your scene to set the user agent or profile path without writing code. - It is normal to see several
ZFGameBrowser
child processes once a browser has been opened. - A number of events, such as page load error, are available for you to hook into. Search
Browser.cs
for "public event" and read the documentation above each. - Disabling the Browser MonoBehaviour will not stop the underlying browser from running. Destroy the object or load a blank page to free up resources a page is using.
- It's not officially supported, but some features of WebRTC might work if you enable a certain command-line switch. See
BrowserNative.commandLineSwitches
and be sure to note the security implications. - Don't create folders named
GPUCache
,VideoDecodeStats
,blob_storage
where your project runs. Chromium may put things into such folders which are cleaned up on exit. - You can adjust the command-line switches sent to Chromium by fiddling with
BrowserNative.commandLineSwitches
. Read the comment above it in BrowserNative.cs for instructions.
Latency/Performance
The browser is rendered offscreen in a separate process and the resulting pixels are transferred to a texture. Performance will not be as good as native Chromium, but should generally be fair to decent.
Latency:
- All activity (mouse clicks, JS calls, input) is sent asynchronously to a separate renderer process and the results are asynchronously reported back. As such, there is a short delay between when a command is issued and when the results are visible. The delay should be quite reasonable in most cases, but don't expect results the same frame you issue a command.
- Avoid using a Browser for latency-critical use cases such as rhythm games, world-aligned HUD markers, and rendering mouse cursors.
Performance:
- If framerates are more important for your use case, you may want to fiddle with the command-line option
--disable-gpu-vsync
. SeeBrowserNative.commandLineSwitches
. - At present the texture is typically composited on the GPU, then pulled back to the CPU and uploaded again in Unity via
LoadRawTextureData
.- ...unless you turn on mip-maps. Generating mipmaps is expensive, and we don't use
LoadRawTextureData
. The included prefabs turn off mipmap generation and use a special mipmap-emulating shader that "fakes" a texture with mipmaps, keeping ugly pixelation at bay for a minimal cost. (Check out theMaterials/EmulatedMipmap
folder.)
- ...unless you turn on mip-maps. Generating mipmaps is expensive, and we don't use
- You may have more success using lower-resolution images for animations and things that frequently update. Large sizes are more suitable for static displays and user interfaces.
- At high enough resolutions, uploading to the GPU can become a notable bottleneck. There's typically a limit to the number of pixels/frame that can be updated without slowing down the game loop.
- Remember that on almost all systems the browsers use the same GPU for rendering that Unity does. If you have heavy content, be sure to factor this into your rendering budget.
Architecture
Chromium doesn't play nice with others. To keep everyone happy and fix many bugs, Chromium is actually run in a separate process and we talk to it via IPC (a mixture of named pipes for messages and shared memory for the rendered buffer). You'll notice that your game spawns a ZFGameBrowser process which in turn spawns the usual Chromium child processes; this is normal.
Adobe Flash
This version of ZFBrowser includes some experimental support for Adobe Flash. Using this is discouraged and support for it may be removed in the future. Additional, note that Adobe plans to end support for Flash at the end of 2020.
Support for Flash is experimental. A command prompt window may flash while starting Flash content.
Enabling Flash requires some extra steps; see below.
Do I need it?
The Web is an evolving place and ever-increasingly interactive web sties don't need Flash to support media-rich content.
You need Flash if you want to:
- Display content that is only available with Flash.
- Watch video that uses proprietary codecs, such as h.264. ZFBrowser doesn't have licenses for these codecs, but Flash does and video streaming sites may fall back to using a Flash player to stream content if necessary.
Note that outdated versions of the Flash plugin may not function. User interaction may be required to start Flash content.
For myself (manual install)
If you are developing locally, prototyping, or will only distribute your application to computers that you control, use this method.
Instructions:
- Install the Adobe Flash Player on your system.
- Go to https://get.adobe.com/flashplayer/otherversions/
- Select your OS
- Select the latest "PPAPI" version available.
- Uncheck boxes for things you don't want.
- Download now.
- Install using the usual methods for your OS.
- Open up BrowserNative.cs. Under
commandLineSwitches
make sure--enable-system-flash
is there.- For Linux: Try these arguments instead:
--ppapi-flash-path=/usr/lib/adobe-flashplugin/libpepflashplayer.so
, updating the path with the actual file location, if needed.--ppapi-flash-version=29.0.0.113
, replacing the version with your actual version (look in<install folder>/manifest.json
).
- For Linux: Try these arguments instead:
- Go! (You may need to restart the Editor.)
You'll need to install Flash on every computer you distribute your application to.
For anyone (distribute Flash)
To distribute Flash with your application, you'll need to get permission from Adobe and run their installer with your installer.
General flow: Untested, let me know how it goes!
- Start development using the instructions in the last section, including the
--enable-system-flash
flag. (You'll need to get creative for the Linux requirements.) - Get a distributor's license for your application
- Apply here
- Fill out paperwork, get approval from Adobe.
- Get an installer from Adobe. You need the PPAPI version (for Chromium).
- Set up the Flash installer to run when your application installs.
Get Help
Need help? Go here!