sarbagyastha / youtube_player_flutter

Flutter plugin for playing or streaming YouTube videos inline using the official iFrame Player API. Supports both Android and iOS platforms.
BSD 3-Clause "New" or "Revised" License
682 stars 752 forks source link

Request for Comment: Hybrid Composition vs Virtual Display #809

Open moribellamy opened 1 year ago

moribellamy commented 1 year ago

I just wanted to post my findings here and see if the community had anything to add. Sorry I could not find a message board or some other venue.

YoutubePlayerFlags has a flag called useHybridComposition which is on by default.

Evidently the mode of rendering native UI is a complex topic with a lot of opinions: https://github.com/flutter/flutter/wiki/Android-Platform-Views https://github.com/flutter/flutter/wiki/Hybrid-Composition#performance

The docs seem to imply that HybridComposition is a newer technique, and it was created in response to problems of dynamically interacting with the underlying UI. As a cost, one of the above links warns us:

While a platform view is rendered with Hybrid Composition, the Flutter UI is composed from the platform thread, which competes with other tasks like handling OS or plugin messages, etc.

I think this caused video to be unwatchable on cheaper Amazon Fire Kindles for me. (I have a rive animation playing as well, so that might be the straw that broke the camel's back). So I just opted in to the older Virtual Display mode, which for me is OK since I don't need to send touch events to the underlying web view.

So, has anyone else found choosing one of these modes has performance impact?

hamzatuna commented 5 months ago

I have the same problem, have you solved this issue @moribellamy ?