Skip to content

Commit

Permalink
Updated README, format of some code
Browse files Browse the repository at this point in the history
  • Loading branch information
maxxfrazer committed Feb 2, 2021
1 parent 8161e88 commit f06e584
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Agora UIKit for iOS and macOS

![.github/workflows/podlint.yml](https://github.com/AgoraIO-Community/iOS-UIKit/workflows/.github/workflows/podlint.yml/badge.svg)
![.github/workflows/podlint.yml](https://github.com/AgoraIO-Community/iOS-UIKit/workflows/Pod%20Lint/badge.svg)
![.github/workflows/swiftlint.yml](https://github.com/AgoraIO-Community/iOS-UIKit/workflows/swiftlint/badge.svg)

Instantly integrate Agora in your own application or prototype using iOS or macOS.

Expand Down
37 changes: 11 additions & 26 deletions Sources/Agora-UIKit/AgoraVideoViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,24 @@ open class AgoraVideoViewer: MPView {

public static func == (lhs: AgoraVideoViewer.Style, rhs: AgoraVideoViewer.Style) -> Bool {
switch (lhs, rhs) {
case (.grid, .grid), (.floating, .floating):
return true
default:
return false
case (.grid, .grid), (.floating, .floating): return true
default: return false
}
}
}

/// The most recently active speaker in the session. This will only ever be set to remote users, not the local user.
public internal(set) var activeSpeaker: UInt? {
didSet {
self.reorganiseVideos()
}
didSet { self.reorganiseVideos() }
}

/// This user will be the main focus when using `.floating` style.
/// Assigned by clicking a user in the collection view.
/// Can be set to local user.
public var overrideActiveSpeaker: UInt? {
didSet {
if oldValue != overrideActiveSpeaker {
self.reorganiseVideos()
}
}
didSet { if oldValue != overrideActiveSpeaker {
self.reorganiseVideos()
}}
}

/// Setting to zero will tell Agora to assign one for you once connected.
Expand All @@ -124,11 +118,7 @@ open class AgoraVideoViewer: MPView {

/// Gets and sets the role for the user. Either `.audience` or `.broadcaster`.
public var userRole: AgoraClientRole = .audience {
didSet {
print("user role is now broadcaster")
print(self.userRole == .broadcaster)
self.agkit.setClientRole(self.userRole)
}
didSet { self.agkit.setClientRole(self.userRole) }
}

internal var currentToken: String? {
Expand Down Expand Up @@ -222,8 +212,7 @@ open class AgoraVideoViewer: MPView {
/// AgoraRtcEngineKit being used by this AgoraVideoViewer.
lazy public internal(set) var agkit: AgoraRtcEngineKit = {
let engine = AgoraRtcEngineKit.sharedEngine(
withAppId: connectionData.appId,
delegate: self
withAppId: connectionData.appId, delegate: self
)
engine.enableAudioVolumeIndication(1000, smooth: 3, report_vad: true)
engine.setChannelProfile(.liveBroadcasting)
Expand All @@ -243,10 +232,8 @@ open class AgoraVideoViewer: MPView {
if oldValue != self.style {
AgoraVideoViewer.agoraPrint(.info, message: "changed style")
switch self.style {
case .collection:
self.backgroundVideoHolder.isHidden = true
default:
self.backgroundVideoHolder.isHidden = false
case .collection: self.backgroundVideoHolder.isHidden = true
default: self.backgroundVideoHolder.isHidden = false
}
self.reorganiseVideos()
}
Expand Down Expand Up @@ -277,9 +264,7 @@ open class AgoraVideoViewer: MPView {
}

internal var userVideoLookup: [UInt: AgoraSingleVideoView] = [:] {
didSet {
reorganiseVideos()
}
didSet { reorganiseVideos() }
}

internal var userVideosForGrid: [UInt: AgoraSingleVideoView] {
Expand Down

0 comments on commit f06e584

Please sign in to comment.