[PatformView][Windows][gstreamer][video play] PlatformView samples for windows & how can I get HWND for widget

404 views
Skip to first unread message

hereMaxwell

unread,
Oct 12, 2020, 11:47:45 PM10/12/20
to Flutter Development (flutter-dev)
I recently try to write a video play example with gstreamer on windows desktop app, the two ways i tested:
1. native create render target and trans texture id from native to flutter likes android's version do, I try to create a render context with opengl texture and passing the opengl texture id to flutter but Texture widget can't recognize it. So flutter Texture widget should need it's own texture type object, is there any sample for windows' PlatformView?
2. gstreamer can bind with hwnd, so i try to find how to pass widget's hwnd to native. but currently i can't get the sub widget's hwnd, only I can get is the main windows's hwnd, how can i get it?
Any advise would be grateful for me, thx

Stuart Morgan

unread,
Oct 13, 2020, 1:14:56 AM10/13/20
to hereMaxwell, Flutter Development (flutter-dev)
On Mon, Oct 12, 2020 at 8:47 PM hereMaxwell <hereh...@gmail.com> wrote:
I recently try to write a video play example with gstreamer on windows desktop app

There is not currently a good way to do this, unfortunately. The Windows embedding is still in early stages (only having just recently reached alpha), and doesn't yet have any supported way of embedding non-Flutter content.

but Texture widget can't recognize it.

The Texture widget isn't currently supported on Windows, but there is a PR in progress; you can follow https://github.com/flutter/flutter/issues/38601 for updates. That implementation may or may not be sufficiently performant for your needs.
 
is there any sample for windows' PlatformView?

PlatformView is also not yet supported. You can follow https://github.com/flutter/flutter/issues/31713 for updates, but you shouldn't expect to see support for it in the immediate future.
 
currently i can't get the sub widget's hwnd, only I can get is the main windows's hwnd, how can i get it?

If you're writing a plugin the only HWND you have direct access to is the Flutter view's (via the plugin registrar), not the main window. If you're adding your code to the runner directly you'd access it via the FlutterViewController. That's currently internal to the FlutterWindows class (runner/flutter_window.h) but you could easily modify FlutterWindow in your project to expose the controller's HWND.

-Stuart

hereMaxwell

unread,
Oct 13, 2020, 2:30:42 AM10/13/20
to Flutter Development (flutter-dev)
Stuart,  thanks for your reply! that's mean a lot for me.

I want to make sure that is each flutter widget a view type and has it's own HWDN? by design
And if i want to passing a specified view to native, I should try to modify the PluginRegisterWithRegistrar passing the specified view info to native? 
or i can get child widget view from root's view?


Stuart Morgan

unread,
Oct 13, 2020, 2:54:30 AM10/13/20
to hereMaxwell, Flutter Development (flutter-dev)
On Mon, Oct 12, 2020 at 11:30 PM hereMaxwell <hereh...@gmail.com> wrote:
I want to make sure that is each flutter widget a view type and has it's own HWDN? by design

No, the entire Flutter content area is a single HWND.
 
And if i want to passing a specified view to native

There is no native representation of an individual Flutter widget.

As I said, there is currently no good way to integrate a native Windows view into Flutter content. Trying to hack around that by manually adding a child HWND is going to be very limited in what you can accomplish.

-Stuart

hereMaxwell

unread,
Oct 13, 2020, 3:26:28 AM10/13/20
to Flutter Development (flutter-dev)
Stuart,  thanks for your reply!

Oh, I see. I can create a child HWND but i can't integrate it into Flutter content, it's the most critical issue i met. And as your opinion there is no good way to solve it. So i just can monitor the  issue update.

Many thanks again.

Reply all
Reply to author
Forward
0 new messages