i-rinat / freshplayerplugin

ppapi2npapi compatibility layer
MIT License
727 stars 52 forks source link

standalone examples? (not a bug) #354

Closed ecosta1020 closed 7 years ago

ecosta1020 commented 7 years ago

Hi, I got to know about this repo yesterday, so pardon me if I haven't got this right yet.

By looking at the code and the explanations, I can see that freshplayer will open and handle an X window through gtk. The player will "talk" npapi with the browser, and ppapi with the hosted plugin.

I'd also like to do the same. I have a X window (I got from Xlib), and would like to launch a freshplayer window that would host flash movie through the flash player, window that I'd then reparent into my window's hierarchy for easier event handling.

While I have no problem with the xlib part, was wondering if there would be some examples or pointers on how to get there on the driver side, as the whole thing is a bit complex at a first glance.

I was also thinking if it wouldn't be nice if freshplayer could also use ppapi to talk to the application is calling it? first, mozilla would have some software they could use when they surrender to ppapi in a future, and other desktop applications could also benefit from the potential of ppapi, which goes far beyond playing swf's, and would probably help if wanting to port chrome-plugins to other browsers or scenarios.

Regards,

i-rinat commented 7 years ago

that freshplayer will open and handle an X window through gtk.

That's not entirely true. Indeed, there is a code, that creates X window, for full screen mode. But it uses solely Xlib, as code must process raw X events, which is easier in Xlib rather than in GTK+.

Mostly, NPAPI plugins are embedded into a browser. There is a windowless mode: browser passes an X drawable, usually Pixmap, where plugin must write its contents. There is a windowed mode: browser creates an X window and gives it to the plugin to draw to and listen for events from. There is also a variation of windowed mode: browser creates a socket window, and expects plugin to plug another window there via XEmbed protocol.

I have a X window (I got from Xlib), and would like to launch a freshplayer window that would host flash movie through the flash player

Perhaps, XEmbed is the closest thing to what you are trying to achieve.

how to get there on the driver side

Driver? I don't think I get it right. Could you rephrase it?

I was also thinking if it wouldn't be nice if freshplayer could also use ppapi to talk to the application is calling it?

The whole point of the API adapter was to act as a translator. If target plugin uses PPAPI, and browser uses PPAPI, what's the point of a translation layer? In that case plugin can be used directly, as in Chromium/Chrome, for example.

By the way, I built such plugin (https://github.com/i-rinat/ppapi-trace) to figure out how Chromium interacts with PepperFlash. It's useful for debugging purposes, but serves no other purpose.

ecosta1020 commented 7 years ago

Hi, sorry for the delay, just too busy!

I don't know how to quote, so I'll answer inline.

The best method for me would be to open a window (as a child of my app's window) and pass it to your plugin/library, so that I could display a flash movie within my app's window the user could interact with.

With driver-side, I meant if there were any (c code) examples on how to do just that that, to pass a window to the plugin so that I could display a movie on it's own window. I get a bit lost when it come to the callbacks, the naming convention, and the comunication protocol itself, which can be a bit overhelming to the newcomer, I couldn't either find any documentation of the protocol other than in form of c code.

I know the point of your plugin is to let firefox use a ppapi plugin it couldn't otherwise handle at this time, but that would allow chrome users to use it, instead of the native one (for some reason in particular), and also other host-side programs.

IPC it's being used throughly and extensively since it's inception back in the good old unix days, so it doesn't need to be just a browser the one willing to use your plugin.

Taking my application as example, I could end up showing and interacting with a movie without having to implement anything related to flash, or for that matter, not even needing to link at compile-time with any of the libraries your plugin does. I'd just interact with it though the established protocol and that's it.

So if it could also accept ppapi on input (the browser side), it would both be a living example, and a tool other programs could use not only for flash (in the case one could do some useful thing through ppapi that couldn't through npapi, as ppapi is meant to be a more robust and flexible format), but for other browser plugins or host applications, that could call each other through ppapi.

For example: a fullscreen browser plugin that shows a 3d perspective, which calls other plugin (through ppapi) to load in such view a file in, say, dxf format, or to other plugin to load, a file in another format. Or the same example for a host application.

It's all about modularity, nor the first plugin or application needs to even know that one format or other exists, all it would want is a list of triangles in 3d space to show on screen, which would be given by some other plugin. The possibilities are endless.

Well, thanks for your quick answer, and again, sorry for the delay. I'm looking forward so hard to have a bit of time to get into this, looks so exciting to me.

Regards,

i-rinat commented 7 years ago

I don't understand what you are talking about, and what you are trying to achieve.

At the moment I could guess you are thinking about PPAPI as an object system to communicate between processes. I think there are already tons of that stuff, forgotten and unused. So there would be no use of another standard. More to that. PPAPI is a defined set of interfaces. It's not extensible by external applications.

If you need a meta-object system and a data bus, just take something already existing. Or design own, with a feature set you need.

so that I could display a flash movie within my app's window the user could interact with.

There are QtWebKit, WebKitGTK+, and Chromium Embedded Framework. They can be used to embed a web view into application. As far as I know, first two support NPAPI plugins, and can load Flash either directly, or through FreshPlayerPlugin. CEF should support PPAPI Flash directly.

I don't know how to quote

Here is the formatting guide: https://guides.github.com/features/mastering-markdown/