Skip to content

Commit 0065618

Browse files
authored
Merge pull request #57 from ant-media/refactor_conference_players
Refactor conference players and Support changing resolution of subtrack
2 parents d0c890a + 9cfa341 commit 0065618

File tree

9 files changed

+158
-156
lines changed

9 files changed

+158
-156
lines changed

WebRTC-Sample-App/Base.lproj/Main.storyboard

+47-47
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
33
<device id="retina6_0" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="System colors in document resources" minToolsVersion="11.0"/>
9+
<capability name="collection view cell content view" minToolsVersion="11.0"/>
910
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1011
</dependencies>
1112
<scenes>
@@ -168,27 +169,48 @@ WebRTC Live Streaming</string>
168169
<objects>
169170
<viewController storyboardIdentifier="Conference" id="E4n-9I-LrE" customClass="ConferenceViewController" customModule="WebRTC_Sample_App" customModuleProvider="target" sceneMemberID="viewController">
170171
<view key="view" contentMode="scaleToFill" id="CM5-Lj-3ty">
171-
<rect key="frame" x="0.0" y="0.0" width="390" height="787"/>
172+
<rect key="frame" x="0.0" y="0.0" width="390" height="834"/>
172173
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
173174
<subviews>
174-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zBK-Om-nWf">
175-
<rect key="frame" x="16" y="47" width="179" height="370"/>
175+
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="v8Q-eO-C1v">
176+
<rect key="frame" x="0.0" y="0.0" width="390" height="834"/>
177+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
176178
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
177-
</view>
178-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PKz-rN-me0">
179-
<rect key="frame" x="206.66666666666663" y="47" width="175.33333333333337" height="346.66666666666669"/>
180-
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
181-
</view>
182-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qPy-8E-T6N">
183-
<rect key="frame" x="16" y="417" width="179" height="350"/>
184-
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
185-
</view>
186-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LXN-aK-Wm3">
187-
<rect key="frame" x="195" y="417" width="196" height="350"/>
188-
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
189-
</view>
179+
<collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="2Nz-ci-6za">
180+
<size key="itemSize" width="272" height="256"/>
181+
<size key="headerReferenceSize" width="0.0" height="0.0"/>
182+
<size key="footerReferenceSize" width="0.0" height="0.0"/>
183+
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
184+
</collectionViewFlowLayout>
185+
<cells>
186+
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="playerCell" id="J7e-Mg-61f" customClass="CellView" customModule="WebRTC_Sample_App" customModuleProvider="target">
187+
<rect key="frame" x="59" y="0.0" width="272" height="256"/>
188+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
189+
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="uPH-qA-2vf">
190+
<rect key="frame" x="0.0" y="0.0" width="272" height="256"/>
191+
<autoresizingMask key="autoresizingMask"/>
192+
<subviews>
193+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="R5H-io-ymV" customClass="RTCMTLVideoView">
194+
<rect key="frame" x="0.0" y="0.0" width="272" height="256"/>
195+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
196+
</view>
197+
</subviews>
198+
<constraints>
199+
<constraint firstItem="R5H-io-ymV" firstAttribute="top" secondItem="uPH-qA-2vf" secondAttribute="top" id="Bzy-hV-kM4"/>
200+
<constraint firstAttribute="trailing" secondItem="R5H-io-ymV" secondAttribute="trailing" id="Hho-93-tzM"/>
201+
<constraint firstItem="R5H-io-ymV" firstAttribute="leading" secondItem="uPH-qA-2vf" secondAttribute="leading" id="N5p-vv-z77"/>
202+
<constraint firstAttribute="bottom" secondItem="R5H-io-ymV" secondAttribute="bottom" id="hYm-6e-Ujt"/>
203+
</constraints>
204+
</collectionViewCellContentView>
205+
<size key="customSize" width="272" height="256"/>
206+
<connections>
207+
<outlet property="playerView" destination="R5H-io-ymV" id="Akp-w5-wvC"/>
208+
</connections>
209+
</collectionViewCell>
210+
</cells>
211+
</collectionView>
190212
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zwp-DO-5T7">
191-
<rect key="frame" x="267" y="607" width="90" height="160"/>
213+
<rect key="frame" x="267" y="654" width="90" height="160"/>
192214
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
193215
<constraints>
194216
<constraint firstAttribute="height" constant="160" id="dnu-X9-a9W"/>
@@ -199,64 +221,42 @@ WebRTC Live Streaming</string>
199221
<viewLayoutGuide key="safeArea" id="dqn-Tz-Jj5"/>
200222
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
201223
<constraints>
202-
<constraint firstAttribute="trailingMargin" secondItem="LXN-aK-Wm3" secondAttribute="trailing" constant="-17" id="3Bd-dA-tuF" userLabel="trailingMargin = Remote View3.trailing"/>
203-
<constraint firstItem="dqn-Tz-Jj5" firstAttribute="centerY" secondItem="zBK-Om-nWf" secondAttribute="bottom" id="4hl-T0-KDm"/>
204-
<constraint firstItem="PKz-rN-me0" firstAttribute="leading" secondItem="zBK-Om-nWf" secondAttribute="trailing" id="5Dx-Cr-rqG"/>
205-
<constraint firstItem="zBK-Om-nWf" firstAttribute="top" secondItem="dqn-Tz-Jj5" secondAttribute="top" id="6wq-5e-Mj6"/>
206-
<constraint firstItem="PKz-rN-me0" firstAttribute="top" secondItem="zBK-Om-nWf" secondAttribute="top" id="AqV-nA-EmJ"/>
207-
<constraint firstAttribute="centerX" secondItem="zBK-Om-nWf" secondAttribute="trailing" id="E4k-YY-Q71" userLabel="centerX = Remote View1.trailing"/>
208224
<constraint firstItem="dqn-Tz-Jj5" firstAttribute="bottom" secondItem="Zwp-DO-5T7" secondAttribute="bottom" constant="20" id="Fpc-aE-wjW" userLabel="Safe Area.bottom = Local View.bottom"/>
209-
<constraint firstItem="LXN-aK-Wm3" firstAttribute="top" secondItem="qPy-8E-T6N" secondAttribute="top" id="I4Q-cM-hh1"/>
210-
<constraint firstItem="LXN-aK-Wm3" firstAttribute="leading" secondItem="qPy-8E-T6N" secondAttribute="trailing" id="Q0S-IU-LsM"/>
211-
<constraint firstItem="qPy-8E-T6N" firstAttribute="centerX" secondItem="zBK-Om-nWf" secondAttribute="centerX" id="QRh-rT-aK6"/>
212-
<constraint firstItem="zBK-Om-nWf" firstAttribute="leading" secondItem="CM5-Lj-3ty" secondAttribute="leadingMargin" id="S5L-m5-Yrb"/>
213-
<constraint firstAttribute="centerY" secondItem="PKz-rN-me0" secondAttribute="bottom" id="Um9-Ar-5G8"/>
214-
<constraint firstItem="qPy-8E-T6N" firstAttribute="top" secondItem="zBK-Om-nWf" secondAttribute="bottom" id="gap-oY-sdl"/>
215-
<constraint firstItem="zBK-Om-nWf" firstAttribute="trailing" secondItem="qPy-8E-T6N" secondAttribute="trailing" id="jgL-N3-IEF"/>
216-
<constraint firstItem="PKz-rN-me0" firstAttribute="leading" secondItem="zBK-Om-nWf" secondAttribute="trailing" constant="11.5" id="kqQ-65-DXL" userLabel="Remote View1.leading = Remote View0.trailing"/>
217-
<constraint firstItem="dqn-Tz-Jj5" firstAttribute="trailing" secondItem="PKz-rN-me0" secondAttribute="trailing" constant="8" id="m4p-r2-kiA" userLabel="Safe Area.trailing = Remote View2.trailing"/>
218-
<constraint firstItem="qPy-8E-T6N" firstAttribute="bottom" secondItem="Zwp-DO-5T7" secondAttribute="bottom" id="m71-fp-qJf"/>
219-
<constraint firstItem="qPy-8E-T6N" firstAttribute="leading" secondItem="zBK-Om-nWf" secondAttribute="leading" id="mUF-pe-umD"/>
220225
<constraint firstItem="dqn-Tz-Jj5" firstAttribute="trailing" secondItem="Zwp-DO-5T7" secondAttribute="trailing" constant="33" id="pND-Zi-qjI" userLabel="Safe Area.trailing = Local View.trailing"/>
221-
<constraint firstItem="LXN-aK-Wm3" firstAttribute="leading" secondItem="qPy-8E-T6N" secondAttribute="trailing" id="wgl-l8-6b7"/>
222-
<constraint firstItem="LXN-aK-Wm3" firstAttribute="bottom" secondItem="Zwp-DO-5T7" secondAttribute="bottom" id="xyb-wW-VhS"/>
223226
</constraints>
224227
</view>
225228
<navigationItem key="navigationItem" id="l7b-W5-MXv"/>
226229
<connections>
230+
<outlet property="collectionView" destination="v8Q-eO-C1v" id="tlK-Cg-lCn"/>
227231
<outlet property="localView" destination="Zwp-DO-5T7" id="ada-FF-Y7z"/>
228-
<outlet property="remoteView0" destination="zBK-Om-nWf" id="pbU-sW-7CT"/>
229-
<outlet property="remoteView1" destination="PKz-rN-me0" id="Uz2-bp-z9s"/>
230-
<outlet property="remoteView2" destination="qPy-8E-T6N" id="fzb-yG-Td5"/>
231-
<outlet property="remoteView3" destination="LXN-aK-Wm3" id="v8t-Qa-1hx"/>
232232
</connections>
233233
</viewController>
234234
<placeholder placeholderIdentifier="IBFirstResponder" id="6tn-JR-W3G" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
235235
</objects>
236-
<point key="canvasLocation" x="1194.4000000000001" y="869.41529235382313"/>
236+
<point key="canvasLocation" x="1193.8461538461538" y="868.72037914691941"/>
237237
</scene>
238238
<!--Video View Controller-->
239239
<scene sceneID="pqe-YK-PtD">
240240
<objects>
241241
<viewController storyboardIdentifier="Video" id="xVm-wQ-O5q" customClass="VideoViewController" customModule="WebRTC_Sample_App" customModuleProvider="target" sceneMemberID="viewController">
242242
<view key="view" contentMode="scaleToFill" id="LyJ-zl-XYS">
243-
<rect key="frame" x="0.0" y="0.0" width="390" height="787"/>
243+
<rect key="frame" x="0.0" y="0.0" width="390" height="834"/>
244244
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
245245
<subviews>
246246
<view hidden="YES" contentMode="center" translatesAutoresizingMaskIntoConstraints="NO" id="cFD-yb-BM7" customClass="RTCEAGLVideoView">
247-
<rect key="frame" x="0.0" y="47" width="390" height="740"/>
247+
<rect key="frame" x="0.0" y="0.0" width="390" height="834"/>
248248
<color key="backgroundColor" red="0.32549019607843138" green="0.32549019607843138" blue="0.32549019607843138" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
249249
</view>
250250
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="lwh-ZV-HkX" customClass="RTCEAGLVideoView">
251-
<rect key="frame" x="270" y="637" width="90" height="120"/>
251+
<rect key="frame" x="270" y="684" width="90" height="120"/>
252252
<color key="backgroundColor" red="0.086274509803921567" green="0.086274509803921567" blue="0.086274509803921567" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
253253
<constraints>
254254
<constraint firstAttribute="height" constant="120" id="FEQ-6q-T1I"/>
255255
<constraint firstAttribute="width" constant="90" id="pW9-Zi-CJA"/>
256256
</constraints>
257257
</view>
258258
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H3f-3T-91O">
259-
<rect key="frame" x="15" y="293.66666666666669" width="45" height="200"/>
259+
<rect key="frame" x="15" y="317" width="45" height="200"/>
260260
<subviews>
261261
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5j2-CR-zdD" userLabel="Audio Button">
262262
<rect key="frame" x="2" y="0.0" width="40" height="40"/>

WebRTC-Sample-App/CellView.swift

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// CellView.swift
3+
// WebRTC-Sample-App
4+
//
5+
// Created by Ahmet Oguz Mermerkaya on 15.07.2024.
6+
//
7+
8+
import Foundation
9+
import UIKit
10+
import WebRTC
11+
public class CellView: UICollectionViewCell {
12+
13+
14+
@IBOutlet weak var playerView: RTCMTLVideoView!
15+
16+
var videoTrack:RTCVideoTrack?
17+
18+
public override func prepareForReuse() {
19+
videoTrack?.remove(playerView)
20+
}
21+
22+
}

0 commit comments

Comments
 (0)