Description
I'm currently working on a custom browser instance that will be used in a specific setting for developing applications that will run on Smart TV set's.
One of the interfaces in the API that I will be implementing in the custom browser, requires the addition of an <object...> tag with a special mime type to be injected into the page dom.
Most "TV Applications" developed to use this API, perform that operation as follows:
the result of this will result in the following tag:
<object type="video/broadcast" id="MediaPlayer"></object>
being added to the page. This tag when the "play()" method is called on it, will start presenting to the user, the current image present on the broadcast video tuner in the device. This is part of the OIPF/HbbTV smart TV application environment.
At present I'm creating a desktop browser, that allows the developer using it, to load into and debug an HTML Application written to follow this standard, rather than the very difficult closed environment that exists on most TV sets.
In order for me to perform this task, I need to implement the API, that the external applications expect to be present on the device, a task which is now well underway, as WebView2 has to date been the only web control that we've come accros that provides suitable features to allow the API to work the way the specs state it should. The only thing we don't have is the "object" tag handling.
When the object is added, the chromium kernel, displays it as follows:
This is not unexpected, as the browser instance behind the scenes does not have an API object registered within it's API layer, that understands that media type.
In order for me to implement this "object" tag correctly, I need to do 2 things.
-
Be told by the browser when one of these tags is seen and be given a reference to the object, that allows me to work with it.
-
Be told when the object needs to be painted (In the case of this example, it will be painted with a Television broadcast from a DVB-T Tuner) so that I can paint the correct data into the control.
I do have a few JavaScript shims I'm playing about with to try and make something work, but having an interface and event similar to the IObject interface in AngleBrackets would be much more helpful, then we could just add our own properties and methods to the object when created, and paint the controls rectangle as required.
Might I suggest some kind of event that is surfaced to the webview control that restricts access ONLY to that object and nothing else in the DOM, and maybe some C# level functionality that allows us to for EG: blah.addProperty("foo", "fooValue") or blah.addFunction("blahFunction", "//blah function JS code...")
The return should be a bool, thus allowing us in the application to say, yes we implemented this (return true) and if we don't return false, so the browser can show the "isn't supported" UI story.
If the implementation in application hosting the control supports an object of a given type, then it should
- Respond to the "object event" with a true
- implement any backend host objects needed
- add any custom properties, methods needed to the new object and wire up any calls needed to any host objects created
- Register any paint or other events so the control rectangle can be painted as needed.
To highlight this with an example of what I'm trying to do, If i was to create a "video/broadcast" object, then I would need to implement methods such as "bindToCurrentChannel":
as documented in Volume 5 section 7.13 of the OIPF Specification Version 2.
Some objects are already natively handled, for example to play an MP4 the same process is used, but a media type of "video/mpeg", "video/mpg" or "video/mp4" is used. All the browsers, including WebView2 already handle this, although I have yet to verify that the API calls and methods are the same, but I may be able to patch those using a weak-map on the JS side if not.
If you want more information, or would like a copy of the spec document, I can provide them for you.
Regards
Shawty