twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
457 stars 177 forks source link

Migrating from 2.x to 4.4 - Video not filling the frame #620

Closed Shagans982 closed 3 years ago

Shagans982 commented 3 years ago

Im in the process of migrating over from 2.10.2 to 4.4 and my video frames used to fill simply by setting the contentMode to AspectFill, now no matter what the contentMode is, it never fills the frame. I have constraints setup in the storyboard enforcing the view size but the camera preview crops. Any suggestions?

Shagans982 commented 3 years ago

Found the fix - not sure if this is an Xcode bug or a Twilio bug. Im running Xcode 12.5. Setting the contentMode in code solves the issue. Apparently contentMode being set from the Storyboard has no effect.

paynerc commented 3 years ago

@Shagans982,

I looked into this this morning and this is a bug in TVIVideoView. It appears that the specified contentMode is overridden with UIViewContentModeScaleAspectFit during the process of decoding the view from the storyboard.

The workaround you have at the moment is the valid suggested workaround. I will create an internal issue to resolve this so that properties set in the Storyboard are respected.

Ryan

Shagans982 commented 3 years ago

@paynerc I also seem to be getting an issue when adding renderers. When I pass in a VideoView (which does conform to the VideoRenderer Protocol) it tells me it doesn't and crashes. Have you guys seen this before? Ive cleaned the project multiple times, reconnecting IBOutlets etc and the issue still remains.

Shagans982 commented 3 years ago

@paynerc Check this out - what is going on?? Screen Shot 2021-06-23 at 11 43 59 AM

paynerc commented 3 years ago

That looks very strange. How is the smallProviderVideoRenderer configured in the Storyboard?

Shagans982 commented 3 years ago

As a VideoView - This implementation was working fine in 2.10. I simply renamed the class to VideoView from TVIVideoView

paynerc commented 3 years ago

Ah. That may be your problem. The framework is still ObjectiveC, but we use the NS_SWIFT_NAME macro to expose the names in Swift in a more idiomatic fashion. I believe that you are still required to use the class name as it is defined in the framework, so in this instance it would still need to be TVIVideoView in the storyboard editor.

Testing this locally, I see the following in the console output when I attempt to just use VideoView as the class name in the Storyboard editor:

2021-06-23 13:58:53.944750-0400 TestApp[89274:2209861] [Storyboard] Unknown class VideoView in Interface Builder file.
Shagans982 commented 3 years ago

OK that solved it - is this documented anywhere? I would have assumed the rename would have also been made to the underlying ObjC code as well. Keeping names consistent.