ScriptableObject - PPAPI

115 views
Skip to first unread message

Shawn

unread,
Aug 11, 2016, 12:01:48 PM8/11/16
to Pepper-dev
Hello guys,

I am aware that the only available mechanism for the top level app to communicate with the plugin is asynchronous PostMsg / HandleMsg way.

However, I need to support proprietary calls from JS to pepper plugin (scriptability). How I see, the only way to do it is to make my own fork of Chrome and re-enable ScriptableObject along with the single process execution.

As I am a newbie in this domain, can someone advice me how to proceed and where to start from ?


Environment:


OS: Android Lolipop (5.1.1)

Chrome version: v39 


Thanks in advance,

Shawn

Raymes Khoury

unread,
Aug 14, 2016, 8:53:00 PM8/14/16
to Shawn, Pepper-dev
Are you saying that you need a way to synchronously call into the plugin? There is a postMessage variant which allows you to do this with pepper plugins called postMessageAndAwaitResponse.

Shawn

unread,
Aug 15, 2016, 11:47:41 AM8/15/16
to Pepper-dev, shawn....@gmail.com
Dear Raymes,

thanks for your reply! 
Sorry, if my first post was not clear enough. 

No, actually I don't necessarily need a synchronous call. What is more important to me is to provide browser support for many (already deployed) CE-HTML apps making proprietary calls on <object> which would have end up into the plugin.
i.e.

<body onload="document.getElementById('myvid').play(1);">

    <object type="video/mp4" id="myvid" data="myvideo.mp4" width="640" height="480"></object>

</body>


Regards,
Shawn

Raymes Khoury

unread,
Aug 15, 2016, 8:18:13 PM8/15/16
to Shawn, Pepper-dev
I think you should be able to hang your own javascript functions on the <object> element which internally make calls into postMessage, e.g.:

var obj = document.getElementsByTagName('object')[0];
obj.foo = function() { obj.postMessage(...); }; 

Does that solve the problem?

Shawn

unread,
Aug 16, 2016, 5:30:03 AM8/16/16
to Pepper-dev, shawn....@gmail.com
If I understand correctly, you are proposing me to introduce a kind of a wrapper functions inside the app which makes internal postMsg calls. Right ?

Yes. That would be a proper solution, if only I am in position to make modifications of the apps (JS).
Unfortunately, duo to interoperability and the standard which defines the available APIs , I can not influence the changes at the app level.
My only playground is the browser itself. Is there a way to implement such functionality within the browser .. so that every <object> element comes already pre-loaded with wrapper functions (which makes internal postMsg calls) ? If yes, how and where to look at ?

Many thanks !
Shawn

Raymes Khoury

unread,
Aug 16, 2016, 7:54:30 PM8/16/16
to Shawn, Pepper-dev
You could look at using a content script in a Chrome extension: https://developer.chrome.com/extensions/content_scripts. These can be used to modify the content of websites. Otherwise I don't have any specific suggestions other than finding the right place to hack on the browser itself.

Thanks,
Raymes
Reply all
Reply to author
Forward
0 new messages