Remove video-related parts of the CallTutorial
This commit is contained in:
@@ -21,20 +21,17 @@ class CallExampleContext : ObservableObject
|
||||
let mCallStateTracer = CallStateDelegate()
|
||||
var mCall: Call!
|
||||
var proxy_cfg : ProxyConfig!
|
||||
var mVideoDevices : [String] = []
|
||||
var mUsedVideoDeviceId : Int = 0
|
||||
var callAlreadyStopped = false;
|
||||
|
||||
@Published var audioEnabled : Bool = true
|
||||
@Published var videoEnabled : Bool = false
|
||||
@Published var speakerEnabled : Bool = false
|
||||
@Published var microphoneMuted : Bool = false
|
||||
@Published var callRunning : Bool = false
|
||||
@Published var isCallIncoming : Bool = false
|
||||
@Published var dest : String = "sip:arguillq@sip.linphone.org"
|
||||
|
||||
let mRegistrationDelegate = LinphoneRegistrationDelegate()
|
||||
@Published var id : String = "sip:peche5@sip.linphone.org"
|
||||
@Published var passwd : String = "peche5"
|
||||
@Published var id : String = "sip:quetindev@sip.linphone.org"
|
||||
@Published var passwd : String = "dev"
|
||||
@Published var loggedIn: Bool = false
|
||||
|
||||
|
||||
@@ -48,16 +45,10 @@ class CallExampleContext : ObservableObject
|
||||
|
||||
// main loop for receiving notifications and doing background linphonecore work:
|
||||
mCore.autoIterateEnabled = true
|
||||
mCore.callkitEnabled = true
|
||||
mCore.pushNotificationEnabled = true
|
||||
mCore.disableRecordOnMute = true
|
||||
try? mCore.start()
|
||||
|
||||
mVideoDevices = mCore.videoDevicesList
|
||||
|
||||
mCore.addDelegate(delegate: mCallStateTracer)
|
||||
mCore.addDelegate(delegate: mRegistrationDelegate)
|
||||
|
||||
}
|
||||
|
||||
func registrationExample()
|
||||
@@ -78,14 +69,6 @@ class CallExampleContext : ObservableObject
|
||||
}
|
||||
|
||||
|
||||
func createCallParams() throws -> CallParams {
|
||||
let callParams = try mCore.createCallParams(call: nil)
|
||||
callParams.videoEnabled = videoEnabled;
|
||||
callParams.audioEnabled = audioEnabled;
|
||||
|
||||
return callParams
|
||||
}
|
||||
|
||||
// Initiate a call
|
||||
func outgoingCallExample() {
|
||||
do {
|
||||
@@ -93,7 +76,7 @@ class CallExampleContext : ObservableObject
|
||||
{
|
||||
let callDest = try Factory.Instance.createAddress(addr: dest)
|
||||
// Place an outgoing call
|
||||
mCall = mCore.inviteAddressWithParams(addr: callDest, params: try createCallParams())
|
||||
mCall = mCore.inviteAddressWithParams(addr: callDest, params: try mCore.createCallParams(call: nil))
|
||||
|
||||
if (mCall == nil) {
|
||||
print("Could not place call to \(dest)\n")
|
||||
@@ -101,10 +84,6 @@ class CallExampleContext : ObservableObject
|
||||
print("Call to \(dest) is in progress...")
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try mCall.update(params: createCallParams())
|
||||
}
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
@@ -128,6 +107,7 @@ class CallExampleContext : ObservableObject
|
||||
{
|
||||
if (callRunning) {
|
||||
mCall.microphoneMuted = !mCall.microphoneMuted
|
||||
microphoneMuted = mCall.microphoneMuted
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,16 +123,6 @@ class CallExampleContext : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
func changeVideoDevice()
|
||||
{
|
||||
mUsedVideoDeviceId = (mUsedVideoDeviceId + 1) % mVideoDevices.count
|
||||
do {
|
||||
try mCore.setVideodevice(newValue: mVideoDevices[mUsedVideoDeviceId])
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
|
||||
func acceptCall()
|
||||
{
|
||||
do {
|
||||
|
||||
@@ -67,32 +67,13 @@ struct ContentView: View {
|
||||
.foregroundColor(tutorialContext.loggedIn ? Color.green : Color.black)
|
||||
}
|
||||
}
|
||||
VStack(spacing: 0.0) {
|
||||
Text("Call Settings")
|
||||
.font(.largeTitle)
|
||||
.padding(.top, 5)
|
||||
HStack {
|
||||
Text("Call destination :")
|
||||
TextField("", text : $tutorialContext.dest)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
}
|
||||
.padding(.top, 5)
|
||||
HStack {
|
||||
Text("Call destination :")
|
||||
TextField("", text : $tutorialContext.dest)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
}
|
||||
VStack(alignment: .leading) {
|
||||
Toggle(isOn: $tutorialContext.audioEnabled) {
|
||||
Text("Audio")
|
||||
}.frame(width : 140.0)
|
||||
Toggle(isOn: $tutorialContext.videoEnabled) {
|
||||
Text("Video")
|
||||
}.frame(width : 140.0)
|
||||
Button(action: tutorialContext.changeVideoDevice)
|
||||
{
|
||||
Text(" Change camera ")
|
||||
.font(.title)
|
||||
.foregroundColor(Color.white)
|
||||
.background(Color.gray)
|
||||
}
|
||||
.padding(.vertical)
|
||||
.padding(.top, 5)
|
||||
VStack {
|
||||
HStack {
|
||||
Text("Speaker :")
|
||||
Button(action: tutorialContext.speaker)
|
||||
@@ -103,17 +84,19 @@ struct ContentView: View {
|
||||
.frame(width: 60.0, height: 30.0)
|
||||
.background(Color.gray)
|
||||
}
|
||||
Spacer()
|
||||
Button(action: tutorialContext.microphoneMuteToggle) {
|
||||
Text("Mute Mic")
|
||||
.font(.largeTitle)
|
||||
.foregroundColor(Color.white)
|
||||
.frame(width: 180.0, height: 42.0)
|
||||
.background(Color.red)
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
Text("Microphone :")
|
||||
Button(action: tutorialContext.microphoneMuteToggle)
|
||||
{
|
||||
Text(tutorialContext.microphoneMuted ? "Unmute" : "Mute")
|
||||
.font(.title)
|
||||
.foregroundColor(Color.white)
|
||||
.frame(width: 110.0, height: 30.0)
|
||||
.background(Color.gray)
|
||||
}
|
||||
}.padding(.top)
|
||||
}
|
||||
.padding(.top, 5.0)
|
||||
Spacer()
|
||||
VStack {
|
||||
HStack {
|
||||
|
||||
Reference in New Issue
Block a user