Sending the event from plugin to JS layer

69 views
Skip to first unread message

Premkumar C

unread,
May 24, 2013, 6:41:43 AM5/24/13
to firebreath-dev
Hi,

I'm using Firebreath environment to develop a NPAPI plugin abstracting the media player engine of ours to create a web based player.

I'm stuck with the following problem. I've following files,
MyPlugin.cpp
MyPluginAPI.cpp
Player.cpp

MyPluginAPI.cpp/MyPluginAPI.h contains the methods and events I register for the Javascript. But I've another class defined in Player.cpp which actually talks with the underlying MediaPlayer engine to achieve the playback. Playback is working fine. It's like this JS Layer has a Play button, upon button click I call the Play function defined in MyPluginAPI.cpp which in turn calls Play function in Player.cpp to achieve the playback.

Now I'm trying to implement a playback slider bar (progress bar) for which I'll get the value from Player.cpp talking to the MediaPlayer engine. Now I want to send this slider position event up to the JS layer.

If my Player.cpp implementation was in MyPluginAPI.cpp, then I'd have easily got access to the slider position event I've defined and called appropriate method in MyPluginAPI.cpp to percolate the event to JS layer.

Now my problem is, how do I do it from Player.cpp?? Should I inherit the Player class from FB::JSAPIAuto??

Thanks,
Prem

Richard Bateman

unread,
May 24, 2013, 10:48:47 AM5/24/13
to firebre...@googlegroups.com

getRootJSAPI() in your plugin class will give you the FB:JSAPIPtr class for your JSAPI object.  boost::dynamic_cast<YourPluginAPI>(getRootJSAPI()) will give you a YourPluginAPIPtr cast of the root JSAPI object that will have your methods on it.

Richard

--
 
---
You received this message because you are subscribed to the Google Groups "firebreath-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebreath-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Premkumar C

unread,
May 27, 2013, 4:06:26 AM5/27/13
to firebreath-dev
Hi Richard,

Thanks for the response. I'll try out this and update the thread.

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