SwiftUI VideoPlayer player How to resize the window when loading new AVAsset?

I am building a macOs app with SwiftUI
I would like to have the window resize according the media's aspect ratio, like what vlc player does.
But I could not found any function to control the size of the window on runtime.
The "frame" control either produce a fixed size window or not working(maxH maxW) at all.

SwiftUI VideoPlayer player How to resize the window when loading new AVAsset?
 
 
Q