Video type does not seem to matter.
I did not see this in earlier versions of 2.0 or 3.0, but definitely with 3.0.11.1. First appears with 3.0.7; can't comment on 4.0.
Sometimes things scale properly when first loaded, but mostly not.
Working with macOS 10.14 Mojave, macOS 10.15 Catalina.
Qt5.13.2
Not sure it's okay for me to mention here an issue with initial sizing of RTSP streams not solved by the workaround code above, since I just posted details in VLCKit#486 (closed)... so I just leave this quick link to that :)
I might be wrong, be I think I checked a couple of months back and the fix was present in 4.0, but not in 3.x; it might have been merged later, though. In all cases, I want to thank you all SO VERY MUCH in advance if you're able to fix this in 3.0.18, because this is really killing me. Thank you, reallY!
@alexandre-janniaux Happy to try, thank you for your time. The only thing is, and this is getting embarrassing to admit , I honestly have no clue on how to compile VLCKit while pointing it to the nightly build of VLC. By any chance, VLCKit 3.0.18rc from a couple weeks ago would already include the fix?
@alexandre-janniaux Thank you so much for all your help! I'm happy to report that replacing a previously compiled VLCKit framework with the artifacts you kindly provided today solves the issue of the video size being wrong at launch. A quick video comparing the behavior of the two frameworks in my app (sorry for the delay the RTSP cameras have to start displaying something):
I cannot express how grateful I am, I've been stuck on this for a long time, and I really look forward to be able to use these fixes in an upcoming VLCKit release. Thank you again!
@alexandre-janniaux I hope I won't "overstay my welcome" if I ask you one last question.
In my app, I provide keyboard shortcuts and trackpad gestures to resize the window containing the video player.
I do so by mapping the key combinations to NSWindow.setFrame(_ frameRect: NSRect, display displayFlag: Bool, animate animateFlag: Bool), and to keep things "fast" I set the animateFlag parameter to false.
Now, I'm noticing that calling that method with animateFlag = falsewhile linking to the new framework you kindly made available yesterday doesn't seem to trigger the resizing of the view, which instead happened automatically with previous versions of VLCKit.
If I set animateFlag = true, the videoView automatically resizes to the new window dimensions even with the artifacts from yesterday.
I thought I'd provide a quick video showing the different behavior, in case my explanation isn't very clear:
By all means, switching to animate window resizing won't be a deal breaker, but since I understand you've worked on many (or all) of the underlying fixes to the resizing issue, I thought I'd ask if I'm missing something that could invoke the auto-resizing of the videoView even without animating window size changes.
Please, feel free to ignore my question if you don't have time or if it's out of scope for the forum, and again thank you for your work!
Hi and thank you @alexandre-janniaux, I very much appreciate you taking the time to investigate my issue.
I tried to extract the relevant code from my app, hopefully what follows will be helpful to reproduce the issue and won't take you too much time to setup.
First, I set my app's main window, the one containing the videoView, to a NSWindow subclass with a couple helper methods for handling the resizing (basically, I'm wrapping NSWindow.setFrame(_ frameRect: NSRect, display displayFlag: Bool, animate animateFlag: Bool) with some niceties):
importCocoa// A few preset values for resizingenumWindowPresetSize:CGFloat{casesmall=8caseregular=4caselarge=2}classWindow:NSWindow{funcresizeToPreset(presetSize:WindowPresetSize,animate:Bool){ifletvisibleScreenFrame=NSScreen.main?.visibleFrame,letwindowContentView=contentView{letvideoPlayerWidth=windowContentView.frame.widthletvideoPlayerHeight=windowContentView.frame.heightletaspectRatio=videoPlayerWidth/videoPlayerHeightvarnewSize=CGSize()letwidth=min((visibleScreenFrame.height*aspectRatio)/presetSize.rawValue,visibleScreenFrame.width/presetSize.rawValue)newSize=CGSize(width:width,height:visibleScreenFrame.height/presetSize.rawValue)resizeWindow(newSize:newSize,animate:animate)}}fileprivatefuncresizeWindow(newSize:NSSize,animate:Bool){varnewFrame=self.frame// Prevent window from moving during the resize processnewFrame.origin.y+=newFrame.size.heightnewFrame.origin.y-=newSize.heightnewFrame.size=newSizeself.setFrame(newFrame,display:true,animate:animate)}}
Then, in my NSViewController subclass, I hook up a few calls to the resizing method above, in order to test the different scenarios (with animation, when it properly resizes automatically the video to fit the window, and without animation, where I'm seeing the issue of the video not scaling down):
classViewController:NSViewController{//...// Working as expected:@IBActionfuncmakeSmallAnimating(_sender:Any){(self.videoView.windowas?Window)?.resizeToPreset(presetSize:.small,animate:true)}@IBActionfuncmakeRegularAnimating(_sender:Any){(self.videoView.windowas?Window)?.resizeToPreset(presetSize:.regular,animate:true)}// Window resizes, but the video doesn't scale:@IBActionfuncmakeSmallWithoutAnimation(_sender:Any){(self.videoView.windowas?Window)?.resizeToPreset(presetSize:.small,animate:false)}@IBActionfuncmakeRegularWithoutAnimation(_sender:Any){(self.videoView.windowas?Window)?.resizeToPreset(presetSize:.regular,animate:false)}// ...}
I hope this will allow you to test what I'm reporting without spending too much time on it. Did I say thank you? Thank you!
Finally, sorry if I didn't provide you a stand-alone functioning example; actually, I could if you need me to, but I'll probably need a couple days to set things up in a new focused example app.
@alexandre-janniaux I am not sure why, but compiling and embedding today's VLCKit-3.4.1b12 seems to have fixed the issue I reported yesterday: with this version, the media size is always correct at launch, same as with your fix from a few days ago, but resizing the window without animating the change also is properly fitting the video to new window size. Both if it's something you've done or not, thank you so much for your help!