video - OSX AVPlayerView resizing when play starts -


i have avplayerview 2nd nssplitviewitem in nssplitviewcontroller. 1st split item list of videos. when select video, plays in avplayerview. problem is, after call [self.videoview.player play]; mediaviewcontroller's view resizes depending on size of video being played.

i'm using storyboards , mediaviewcontroller on canvas has avplayerview top/bottom/trailing/leading set hug superview. seems work fine letting window resized , video adjusts size accordingly.

i don't understand @ point view decides resize , stop it.

i have set self.videoview.videogravity = avlayervideogravityresizeaspect;

what missing?

thanks

edit ---------

it seems problem not video size, image overlay have added videoplayer contentoverlayview.

i add overlay this:

if (self.videoview.contentoverlayview.subviews.count == 0) {     // add nsimageview subview use overlays     nsimageview *overlayiv = [[nsimageview alloc] initwithframe:self.videoview.frame];     [overlayiv settranslatesautoresizingmaskintoconstraints:no];     [overlayiv setimagescaling:nsimagescaleproportionallyupordown];     [self.videoview.contentoverlayview addsubview:overlayiv];      // set constraints hug parent     [self.videoview addconstraint:[nslayoutconstraint constraintwithitem:overlayiv                                                                attribute:nslayoutattributetop                                                                relatedby:nslayoutrelationequal                                                                   toitem:self.videoview                                                                attribute:nslayoutattributetop                                                               multiplier:1.0                                                                 constant:0.0]];      [self.videoview addconstraint:[nslayoutconstraint constraintwithitem:overlayiv                                                                attribute:nslayoutattributebottom                                                                relatedby:nslayoutrelationequal                                                                   toitem:self.videoview                                                                attribute:nslayoutattributebottom                                                               multiplier:1.0                                                                 constant:0.0]];      [self.videoview addconstraint:[nslayoutconstraint constraintwithitem:overlayiv                                                                attribute:nslayoutattributeleading                                                                relatedby:nslayoutrelationequal                                                                   toitem:self.videoview                                                                attribute:nslayoutattributeleading                                                               multiplier:1.0                                                                 constant:0.0]];      [self.videoview addconstraint:[nslayoutconstraint constraintwithitem:overlayiv                                                                attribute:nslayoutattributetrailing                                                                relatedby:nslayoutrelationequal                                                                   toitem:self.videoview                                                                attribute:nslayoutattributetrailing                                                               multiplier:1.0                                                                 constant:0.0]]; } 

then when add new image overlay resizes window:

nsimageview *overlayiv = [self.videoview.contentoverlayview.subviews firstobject]; if (overlayiv) {     if (image)     {         overlayiv.image = image;     }     else     {         overlayiv.image = nil;     } } 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -