From f8c67f9ee48cf8e243f38db1f6f602f39e63f15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacques-Olivier=20Hache=CC=81?= Date: Mon, 28 Jun 2021 18:07:29 +0800 Subject: [PATCH] Updated the Skylink dependency to 2.2. That requires an update of the `didChangeVideoSize` prototype. --- SampleAppSwift5/Cartfile | 2 +- SampleAppSwift5/Podfile | 2 +- .../MultiVideoCallViewController.swift | 12 ++++++++---- .../SampleApp_Swift/VideoCallViewController.swift | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/SampleAppSwift5/Cartfile b/SampleAppSwift5/Cartfile index ced61be..26120d3 100644 --- a/SampleAppSwift5/Cartfile +++ b/SampleAppSwift5/Cartfile @@ -1 +1 @@ -github "Temasys/SKYLINK-iOS" "2.1.0" +github "Temasys/SKYLINK-iOS" "2.2.0" diff --git a/SampleAppSwift5/Podfile b/SampleAppSwift5/Podfile index 9bf457f..58bb5a7 100644 --- a/SampleAppSwift5/Podfile +++ b/SampleAppSwift5/Podfile @@ -6,7 +6,7 @@ target 'SampleApp_Swift' do use_frameworks! -pod 'SKYLINK' +pod 'SKYLINK', '~> 2.2' # If facing issues with installation, please use: # pod 'SKYLINK', :git => 'https://github.com/Temasys/SKYLINK-iOS.git' diff --git a/SampleAppSwift5/SampleApp_Swift/MultiVideoCallViewController.swift b/SampleAppSwift5/SampleApp_Swift/MultiVideoCallViewController.swift index 8d4f025..b6af899 100644 --- a/SampleAppSwift5/SampleApp_Swift/MultiVideoCallViewController.swift +++ b/SampleAppSwift5/SampleApp_Swift/MultiVideoCallViewController.swift @@ -233,7 +233,7 @@ class MultiVideoCallViewController: SKConnectableVC, SKYLINKConnectionLifeCycleD self.activityIndicator.stopAnimating() reloadParticipants() } - func connection(_ connection: SKYLINKConnection, didChangeVideoSize videoSize: CGSize, videoView: UIView!, peerId: String) { + func connection(_ connection: SKYLINKConnection, didChangeVideoSize videoSize: CGSize, videoView: UIView!, peerId: String, mediaId: String) { if videoSize.height > 0 && videoSize.width > 0 { let correspondingContainerView = containerViewForVideoView(videoView: videoView) if correspondingContainerView != localVideoContainerView { @@ -248,9 +248,13 @@ class MultiVideoCallViewController: SKConnectableVC, SKYLINKConnectionLifeCycleD peersInfos[peerIds[i]] = ["videoView" : videoView, "videoSize" : videoSize, "isAudioMuted" : isAudioMuted, "isVideoMuted" : isVideoMuted] } } - videoView.frame = (videoAspectSegmentControl.selectedSegmentIndex == 0 || correspondingContainerView.isEqual(localVideoContainerView)) - ? aspectFillRectForSize(insideSize: videoSize, containedInRect: correspondingContainerView.frame) - : AVMakeRect(aspectRatio: videoSize, insideRect: correspondingContainerView.bounds) + + if (videoAspectSegmentControl.selectedSegmentIndex == 0 || correspondingContainerView.isEqual(localVideoContainerView)) { + // TODO: do we need to update frame here? + videoView!.frame = aspectFillRectForSize(insideSize: videoSize, containedInRect: correspondingContainerView.bounds) + } else { + videoView.frame = AVMakeRect(aspectRatio: videoSize, insideRect: correspondingContainerView.bounds) + } } } func connection(_ connection: SKYLINKConnection, didReceiveRemoteMedia remoteMedia: SKYLINKMedia, remotePeerId: String!) { diff --git a/SampleAppSwift5/SampleApp_Swift/VideoCallViewController.swift b/SampleAppSwift5/SampleApp_Swift/VideoCallViewController.swift index 426644c..86e34b7 100644 --- a/SampleAppSwift5/SampleApp_Swift/VideoCallViewController.swift +++ b/SampleAppSwift5/SampleApp_Swift/VideoCallViewController.swift @@ -234,7 +234,7 @@ class VideoCallViewController: SKConnectableVC, SKYLINKConnectionLifeCycleDelega } } - func connection(_ connection: SKYLINKConnection, didChangeVideoSize videoSize: CGSize, videoView: UIView!, peerId: String) { + func connection(_ connection: SKYLINKConnection, didChangeVideoSize videoSize: CGSize, videoView: UIView!, peerId: String, mediaId: String) { if videoSize.height > 0 && videoSize.width > 0 { _ = [localVideoContainerView, remotePeerVideoContainerView, remotePeerVideoContainerView2].compactMap { $0 }.filter { videoView.isDescendant(of: $0) }.map { videoView.aspectFitRectForSize(insideSize: videoSize, inContainer: $0) } }