FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
API-Examples/iOS/APIExample/ViewController.swift at master · thedeveloper19/API-Examples · GitHub
thedeveloper19
/
API-Examples
Public
forked from
AgoraIO/API-Examples
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
API-Examples
/
iOS
/
APIExample
/
ViewController.swift
Copy path
More file actions
More file actions
Latest commit
History
History
History
146 lines (129 loc) · 7.66 KB
Breadcrumbs
API-Examples
/
iOS
/
APIExample
/
ViewController.swift
Copy path
File metadata and controls
146 lines (129 loc) · 7.66 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//
// ViewController.swift
// APIExample
//
// Created by 张乾泽 on 2020/4/16.
// Copyright © 2020 Agora Corp. All rights reserved.
//
import
UIKit
import
Floaty
struct
MenuSection
{
var
name
:
String
var
rows
:
[
MenuItem
]
}
struct
MenuItem
{
var
name
:
String
var
entry
:
String
=
"
EntryViewController
"
var
storyboard
:
String
=
"
Main
"
var
controller
:
String
var
note
:
String
=
"
"
}
class
ViewController
:
AGViewController
{
var
menus
:
[
MenuSection
]
=
[
MenuSection
(
name
:
"
Basic
"
,
rows
:
[
MenuItem
(
name
:
"
Join a channel (Video)
"
.
localized
,
storyboard
:
"
JoinChannelVideo
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Join a channel (Audio)
"
.
localized
,
storyboard
:
"
JoinChannelAudio
"
,
controller
:
"
"
)
]
)
,
MenuSection
(
name
:
"
Anvanced
"
,
rows
:
[
MenuItem
(
name
:
"
Group Video Chat
"
.
localized
,
storyboard
:
"
VideoChat
"
,
controller
:
"
VideoChat
"
)
,
MenuItem
(
name
:
"
Live Streaming
"
.
localized
,
storyboard
:
"
LiveStreaming
"
,
controller
:
"
LiveStreaming
"
)
,
MenuItem
(
name
:
"
RTMP Streaming
"
.
localized
,
storyboard
:
"
RTMPStreaming
"
,
controller
:
"
RTMPStreaming
"
)
,
MenuItem
(
name
:
"
Video Metadata
"
.
localized
,
storyboard
:
"
VideoMetadata
"
,
controller
:
"
VideoMetadata
"
.
localized
)
,
MenuItem
(
name
:
"
Voice Changer
"
.
localized
,
storyboard
:
"
VoiceChanger
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Custom Audio Source
"
.
localized
,
storyboard
:
"
CustomAudioSource
"
,
controller
:
"
CustomAudioSource
"
)
,
MenuItem
(
name
:
"
Custom Audio Render
"
.
localized
,
storyboard
:
"
CustomAudioRender
"
,
controller
:
"
CustomAudioRender
"
)
,
MenuItem
(
name
:
"
Custom Video Source(MediaIO)
"
.
localized
,
storyboard
:
"
CustomVideoSourceMediaIO
"
,
controller
:
"
CustomVideoSourceMediaIO
"
)
,
MenuItem
(
name
:
"
Custom Video Source(Push)
"
.
localized
,
storyboard
:
"
CustomVideoSourcePush
"
,
controller
:
"
CustomVideoSourcePush
"
)
,
MenuItem
(
name
:
"
Custom Video Render
"
.
localized
,
storyboard
:
"
CustomVideoRender
"
,
controller
:
"
CustomVideoRender
"
)
,
MenuItem
(
name
:
"
Raw Media Data
"
.
localized
,
storyboard
:
"
RawMediaData
"
,
controller
:
"
RawMediaData
"
)
,
MenuItem
(
name
:
"
Quick Switch Channel
"
.
localized
,
controller
:
"
QuickSwitchChannel
"
)
,
MenuItem
(
name
:
"
Join Multiple Channels
"
.
localized
,
storyboard
:
"
JoinMultiChannel
"
,
controller
:
"
JoinMultiChannel
"
)
,
MenuItem
(
name
:
"
Stream Encryption
"
.
localized
,
storyboard
:
"
StreamEncryption
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Audio Mixing
"
.
localized
,
storyboard
:
"
AudioMixing
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Precall Test
"
.
localized
,
storyboard
:
"
PrecallTest
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Screen Share
"
.
localized
,
storyboard
:
"
ScreenShare
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Super Resolution
"
.
localized
,
storyboard
:
"
SuperResolution
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Media Channel Relay
"
.
localized
,
storyboard
:
"
MediaChannelRelay
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Media Player
"
.
localized
,
storyboard
:
"
MediaPlayer
"
,
controller
:
"
MediaPlayer
"
)
,
MenuItem
(
name
:
"
ARKit
"
.
localized
,
storyboard
:
"
ARKit
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Create Data Stream
"
.
localized
,
storyboard
:
"
CreateDataStream
"
,
controller
:
"
"
)
,
MenuItem
(
name
:
"
Raw Audio Data
"
.
localized
,
storyboard
:
"
RawAudioData
"
,
controller
:
"
RawAudioData
"
)
,
]
)
,
]
override
func
viewDidLoad
(
)
{
super
.
viewDidLoad
(
)
Floaty
.
global
.
button
.
addItem
(
title
:
"
Send Logs
"
,
handler
:
{
item
in
LogUtils
.
writeAppLogsToDisk
(
)
let
activity
=
UIActivityViewController
(
activityItems
:
[
NSURL
(
fileURLWithPath
:
LogUtils
.
logFolder
(
)
,
isDirectory
:
true
)
]
,
applicationActivities
:
nil
)
if
UIDevice
.
current
.
userInterfaceIdiom
==
.
pad
{
activity
.
popoverPresentationController
?
.
sourceView
=
Floaty
.
global
.
button
}
UIApplication
.
topMostViewController
?
.
present
(
activity
,
animated
:
true
,
completion
:
nil
)
}
)
Floaty
.
global
.
button
.
addItem
(
title
:
"
Clean Up
"
,
handler
:
{
item
in
LogUtils
.
cleanUp
(
)
}
)
Floaty
.
global
.
button
.
isDraggable
=
true
Floaty
.
global
.
show
(
)
}
@
IBAction
func
onSettings
(
_ sender
:
UIBarButtonItem
)
{
let
storyBoard
:
UIStoryboard
=
UIStoryboard
(
name
:
"
Main
"
,
bundle
:
nil
)
guard
let
settingsViewController
=
storyBoard
.
instantiateViewController
(
withIdentifier
:
"
settings
"
)
as?
SettingsViewController
else
{
return
}
settingsViewController
.
settingsDelegate
=
self
settingsViewController
.
sectionNames
=
[
"
Video Configurations
"
,
"
Metadata
"
]
settingsViewController
.
sections
=
[
[
SettingsSelectParam
(
key
:
"
resolution
"
,
label
:
"
Resolution
"
.
localized
,
settingItem
:
GlobalSettings
.
shared
.
getSetting
(
key
:
"
resolution
"
)
!
,
context
:
self
)
,
SettingsSelectParam
(
key
:
"
fps
"
,
label
:
"
Frame Rate
"
.
localized
,
settingItem
:
GlobalSettings
.
shared
.
getSetting
(
key
:
"
fps
"
)
!
,
context
:
self
)
,
SettingsSelectParam
(
key
:
"
orientation
"
,
label
:
"
Orientation
"
.
localized
,
settingItem
:
GlobalSettings
.
shared
.
getSetting
(
key
:
"
orientation
"
)
!
,
context
:
self
)
]
,
[
SettingsLabelParam
(
key
:
"
sdk_ver
"
,
label
:
"
SDK Version
"
,
value
:
"
v
\(
AgoraRtcEngineKit
.
getSdkVersion
(
)
)
"
)
]
]
self
.
navigationController
?
.
pushViewController
(
settingsViewController
,
animated
:
true
)
}
}
extension
ViewController
:
UITableViewDataSource
{
func
tableView
(
_ tableView
:
UITableView
,
numberOfRowsInSection section
:
Int
)
->
Int
{
return
menus
[
section
]
.
rows
.
count
}
func
numberOfSections
(
in tableView
:
UITableView
)
->
Int
{
return
menus
.
count
}
func
tableView
(
_ tableView
:
UITableView
,
titleForHeaderInSection section
:
Int
)
->
String
?
{
return
menus
[
section
]
.
name
}
func
tableView
(
_ tableView
:
UITableView
,
cellForRowAt indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cellIdentifier
=
"
menuCell
"
var
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
cellIdentifier
)
if
cell
==
nil
{
cell
=
UITableViewCell
(
style
:
.
default
,
reuseIdentifier
:
cellIdentifier
)
}
cell
?
.
textLabel
?
.
text
=
menus
[
indexPath
.
section
]
.
rows
[
indexPath
.
row
]
.
name
return
cell!
}
}
extension
ViewController
:
UITableViewDelegate
{
func
tableView
(
_ tableView
:
UITableView
,
didSelectRowAt indexPath
:
IndexPath
)
{
tableView
.
deselectRow
(
at
:
indexPath
,
animated
:
true
)
let
menuItem
=
menus
[
indexPath
.
section
]
.
rows
[
indexPath
.
row
]
let
storyBoard
:
UIStoryboard
=
UIStoryboard
(
name
:
menuItem
.
storyboard
,
bundle
:
nil
)
if
(
menuItem
.
storyboard
==
"
Main
"
)
{
guard
let
entryViewController
=
storyBoard
.
instantiateViewController
(
withIdentifier
:
menuItem
.
entry
)
as?
EntryViewController
else
{
return
}
entryViewController
.
nextVCIdentifier
=
menuItem
.
controller
entryViewController
.
title
=
menuItem
.
name
entryViewController
.
note
=
menuItem
.
note
self
.
navigationController
?
.
pushViewController
(
entryViewController
,
animated
:
true
)
}
else
{
let
entryViewController
:
UIViewController
=
storyBoard
.
instantiateViewController
(
withIdentifier
:
menuItem
.
entry
)
self
.
navigationController
?
.
pushViewController
(
entryViewController
,
animated
:
true
)
}
}
}
extension
ViewController
:
SettingsViewControllerDelegate
{
func
didChangeValue
(
type
:
String
,
key
:
String
,
value
:
Any
)
{
if
(
type
==
"
SettingsSelectCell
"
)
{
guard
let
setting
=
value
as?
SettingItem
else
{
return
}
LogUtils
.
log
(
message
:
"
select
\(
setting
.
selectedOption
(
)
.
label
)
for
\(
key
)
"
,
level
:
.
info
)
}
}
}
Back
|
FazBrowse Home
|
New Git URL