Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter native view all black (when playing local file) #275

Closed
1 of 2 tasks
abdelaziz-mahdy opened this issue May 16, 2022 · 9 comments
Closed
1 of 2 tasks

flutter native view all black (when playing local file) #275

abdelaziz-mahdy opened this issue May 16, 2022 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@abdelaziz-mahdy
Copy link
Contributor

abdelaziz-mahdy commented May 16, 2022

Describe the bug

Flutter native view all black (when playing local file)
but the view is working correctly on links

Another issue
when going to full screen using window manager
the top bar of flutter native view doesn't go away
also, there is a space on each edge (my guess related to flutter native view too)

Media

downloaded video files

Minimal reproducible code

https://github.com/zezo357/flutter_meedu_videoplayer

Flutter logs

paste output of **flutter run --verbose** here (replace this line, and make sure to include --verbose flag).
paste output of **flutter doctor --verbose** here (replace this line, and make sure to include --verbose flag).

Operating system:

  • Platform: e.g. Windows, Ubuntu or macOS etc.
  • OS version: Windows 11 21H2, Ubuntu 20.04 etc.

Other details:

  • I confirm this is not a bug in the VLC app & only dart_vlc.
  • I have donated / sponsored dart_vlc.

Screenshots
image

@abdelaziz-mahdy abdelaziz-mahdy added the bug Something isn't working label May 16, 2022
@alexmercerind
Copy link
Owner

alexmercerind commented May 16, 2022

This is confusing. I'm able to play local files perfectly. There shouldn't be difference, since the video output is itself a VLC window. Make sure you're using Media.file constructor.

For the full screen, yeah that's something needs to be handled separately with flutter_native_view. It'd take some time too.

@abdelaziz-mahdy
Copy link
Contributor Author

abdelaziz-mahdy commented May 16, 2022

this is how i create the player

    Player player = Player(
        id: randomNumber,
        commandlineArguments: [
          //"-vvv",
          '--http-referrer=' + refer,
          '--http-reconnect',
          '--sout-livehttp-caching',
          '--network-caching=60000',
          '--file-caching=60000'
        ],
        registerTexture: !Platform.isWindows); // create a new video controller
    if (dataSource.type == DataSourceType.asset) {
      player.open(
        Media.asset(dataSource.source!),
        autoStart: _autoplay,
      );
    } else if (dataSource.type == DataSourceType.network) {
      print(dataSource.source!);
      player.open(
        Media.network(
          dataSource.source!,
          timeout: Duration(seconds: 10),
          //startTime: seekTo
        ),
        autoStart: _autoplay,
      );
    } else {
      player.open(
        Media.file(
          dataSource.file!,
          //startTime: seekTo
        ),
        autoStart: _autoplay,
      );
    }

is this wrong?

also sound is working just the screen is black

@abdelaziz-mahdy
Copy link
Contributor Author

ok playing local files works, I will check more and tell you where is the main problem

@abdelaziz-mahdy
Copy link
Contributor Author

looks like sometimes the code is not waiting for the UI to link

what I tested

  1. Disabled window manager
    1.1 sometimes the first launch failed then the rest is good
    1.2 sometimes everything is working perfectly
  2. Having window manager enabled and going to full screen 99% of local files fail while network 99% succedes

so when using window manager 99% it doesn't link and gives a black screen

and playing network files gives the code the time to link since it takes a time to start the network video

@abdelaziz-mahdy
Copy link
Contributor Author

any news?

@LarYoungruu
Copy link

LarYoungruu commented Jun 22, 2022

[macOs] Same issue :(

@PauloBTX
Copy link

PauloBTX commented Jul 19, 2022

same issue here. =( but i saw this code in another topic and worked:

ListView(
shrinkWrap: true,
children: [
NativeVideo(
player: _videoPlayer,
height: 420.0,
width: 360.0,
),
],
),

@sadikul1500
Copy link

In my case the screen is white.
image

@alexmercerind
Copy link
Owner

Hi, I have decided to remove NativeVideo widget for now in the latest version v0.4.0.
Since it is no more, this is no longer a concern. Below I have discussed the future plans:

First of all, sorry for being inactive. I've been occupied with my exams & college. Maintaining open-source packages requires consistent work & time out of daily life. Writing C++ & native code is even more tedious.

There are a number of issues with this package, both in regard of performance & stability which I would like to fix. I'm not quite satisfied with the current state of the package, though I believe it is still usable. Hardware acceleration is a big concern. Currently, a substantial amount of load is caused on the CPU when using package:dart_vlc. This is because every video frame is copied from GPU to RAM buffer (which is a CPU process & CPU isn't made for rendering) for drawing it into Flutter's texture widget, both due to Flutter & libvlc's limitations at that time.

I made NativeVideo widget for bringing hardware-acceleration but as it turns out, it is not exactly good & stable alternative i.e. it uses undocumented API from Windows, has other issues while rendering inside widget tree (like you shared). It simply worked by creating another window under actual Flutter window & making a section of Flutter app transparent to display video through it. Thus, a hacky solution.

Now, my work is sponsored by Stream.
I can now proceed my work with peace & build the best-ever performant & stable video library for Flutter Desktop.
I attempted to render using OpenGL the other day: flutter-windows-ANGLE-OpenGL-Direct3D-Interop. I will continue this work.

Thanks!

@alexmercerind alexmercerind closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants