getting sounds working and getting both connected, but the leave channel not triggering
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
89091993277D958D0025F4BB /* ConvoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89091992277D958D0025F4BB /* ConvoViewModel.swift */; };
|
||||
89091995277DD9F80025F4BB /* ConvoFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89091994277DD9F80025F4BB /* ConvoFooterView.swift */; };
|
||||
89091997277DDE030025F4BB /* ProfilePicturesOverlappedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89091996277DDE030025F4BB /* ProfilePicturesOverlappedView.swift */; };
|
||||
89091999277EFDCC0025F4BB /* leaveSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 89091998277EFDCC0025F4BB /* leaveSound.mp3 */; };
|
||||
8909199C277EFDF30025F4BB /* joinSound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 8909199B277EFDF30025F4BB /* joinSound.mp3 */; };
|
||||
890C245D277BF628009B4A30 /* AgoraRtcKit in Frameworks */ = {isa = PBXBuildFile; productRef = 890C245C277BF628009B4A30 /* AgoraRtcKit */; };
|
||||
890C2460277BF896009B4A30 /* AgoraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890C245F277BF896009B4A30 /* AgoraViewController.swift */; };
|
||||
890C2462277BF935009B4A30 /* CallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 890C2461277BF935009B4A30 /* CallView.swift */; };
|
||||
@@ -98,6 +100,8 @@
|
||||
89091992277D958D0025F4BB /* ConvoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvoViewModel.swift; sourceTree = "<group>"; };
|
||||
89091994277DD9F80025F4BB /* ConvoFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvoFooterView.swift; sourceTree = "<group>"; };
|
||||
89091996277DDE030025F4BB /* ProfilePicturesOverlappedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfilePicturesOverlappedView.swift; sourceTree = "<group>"; };
|
||||
89091998277EFDCC0025F4BB /* leaveSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = leaveSound.mp3; sourceTree = "<group>"; };
|
||||
8909199B277EFDF30025F4BB /* joinSound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = joinSound.mp3; sourceTree = "<group>"; };
|
||||
890C245F277BF896009B4A30 /* AgoraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgoraViewController.swift; sourceTree = "<group>"; };
|
||||
890C2461277BF935009B4A30 /* CallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallView.swift; sourceTree = "<group>"; };
|
||||
890C2463277BFA97009B4A30 /* AgroRep.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgroRep.swift; sourceTree = "<group>"; };
|
||||
@@ -194,6 +198,15 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
8909199A277EFDE50025F4BB /* sounds */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8909199B277EFDF30025F4BB /* joinSound.mp3 */,
|
||||
89091998277EFDCC0025F4BB /* leaveSound.mp3 */,
|
||||
);
|
||||
path = sounds;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
890C245E277BF888009B4A30 /* VoiceCallTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -231,6 +244,7 @@
|
||||
891A15DF27653A7000B26659 /* nirvana-ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8909199A277EFDE50025F4BB /* sounds */,
|
||||
891060E527743FEB00F14509 /* nirvana-ios.entitlements */,
|
||||
89AD557D276E01E2001658E0 /* Repositories */,
|
||||
89F05BA2276ACBFA0002E9C7 /* Services */,
|
||||
@@ -587,7 +601,9 @@
|
||||
files = (
|
||||
891A15F12765528700B26659 /* Satisfy-Regular.ttf in Resources */,
|
||||
89A107E927753AB600B971FD /* GoogleService-Info.plist in Resources */,
|
||||
89091999277EFDCC0025F4BB /* leaveSound.mp3 in Resources */,
|
||||
891A15E827653A7100B26659 /* Preview Assets.xcassets in Resources */,
|
||||
8909199C277EFDF30025F4BB /* joinSound.mp3 in Resources */,
|
||||
891A15E527653A7100B26659 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"data" : [
|
||||
{
|
||||
"filename" : "[5]__Notify__Sound.mp3",
|
||||
"filename" : "joinSound.mp3",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"data" : [
|
||||
{
|
||||
"filename" : "[8]__Notify__Sound.mp3",
|
||||
"filename" : "leaveSound.mp3",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
@@ -81,7 +81,6 @@ struct ConvoFooterView: View {
|
||||
Button {
|
||||
print("disconnecting user now ")
|
||||
|
||||
self.convoVM.selectedConvoId = nil
|
||||
self.convoVM.leaveConvo()
|
||||
|
||||
// show success or failure toast
|
||||
|
||||
@@ -87,7 +87,7 @@ class ConvoViewModel: NSObject, ObservableObject {
|
||||
}
|
||||
|
||||
// TODO: if convo receiver is me, then join in
|
||||
if convo!.receiverUserId == userId {
|
||||
if convo!.receiverUserId == userId && !(self?.isInCall())! {
|
||||
self?.joinConvo(convo: convo!)
|
||||
}
|
||||
|
||||
@@ -245,10 +245,12 @@ extension ConvoViewModel {
|
||||
}
|
||||
|
||||
func playJoinAudioEffect(engine: AgoraRtcEngineKit) {
|
||||
print("playing JOINED audio sound")
|
||||
|
||||
// Sets the audio effect ID.
|
||||
let EFFECT_ID:Int32 = 1
|
||||
// Sets the path of the audio effect file.
|
||||
let filePath = Bundle.main.path(forResource: "[8]__Notify__Sound", ofType: "mp3")
|
||||
let filePath = Bundle.main.path(forResource: "joinSound", ofType: "mp3")
|
||||
// Sets the number of times the audio effect loops. -1 represents an infinite loop.
|
||||
let loopCount = 1
|
||||
// Sets the pitch of the audio effect. The value range is 0.5 to 2.0, where 1.0 is the original pitch.
|
||||
@@ -259,7 +261,7 @@ extension ConvoViewModel {
|
||||
// Sets the volume of the audio effect. The value range is 0 to 100. 100 represents the original volume.
|
||||
let gain = 100.0
|
||||
// Sets whether to publish the audio effect to the remote users. true represents that both the local user and remote users can hear the audio effect; false represents that only the local user can hear the audio effect.
|
||||
let publish = true
|
||||
let publish = false
|
||||
// Sets the playback position (ms) of the audio effect file. 500 represents that the playback starts at the 500 ms mark of the audio effect file.
|
||||
let startPos: Int32 = 500;
|
||||
// Plays the specified audio effect file.
|
||||
@@ -267,10 +269,12 @@ extension ConvoViewModel {
|
||||
}
|
||||
|
||||
func playLeaveAudioEffect(engine: AgoraRtcEngineKit) {
|
||||
print("playing LEFT audio sound")
|
||||
|
||||
// Sets the audio effect ID.
|
||||
let EFFECT_ID:Int32 = 2
|
||||
// Sets the path of the audio effect file.
|
||||
let filePath = Bundle.main.path(forResource: "[5]__Notify__Sound", ofType: "mp3")
|
||||
let filePath = Bundle.main.path(forResource: "leaveSound", ofType: "mp3")
|
||||
// Sets the number of times the audio effect loops. -1 represents an infinite loop.
|
||||
let loopCount = 1
|
||||
// Sets the pitch of the audio effect. The value range is 0.5 to 2.0, where 1.0 is the original pitch.
|
||||
@@ -281,7 +285,7 @@ extension ConvoViewModel {
|
||||
// Sets the volume of the audio effect. The value range is 0 to 100. 100 represents the original volume.
|
||||
let gain = 100.0
|
||||
// Sets whether to publish the audio effect to the remote users. true represents that both the local user and remote users can hear the audio effect; false represents that only the local user can hear the audio effect.
|
||||
let publish = true
|
||||
let publish = false
|
||||
// Sets the playback position (ms) of the audio effect file. 500 represents that the playback starts at the 500 ms mark of the audio effect file.
|
||||
let startPos: Int32 = 500;
|
||||
// Plays the specified audio effect file.
|
||||
@@ -320,6 +324,8 @@ extension ConvoViewModel: AgoraRtcEngineDelegate {
|
||||
|
||||
self?.firestoreService.updateConvo(convo: (self?.currConvo)!) {[weak self] res in
|
||||
print(res)
|
||||
|
||||
|
||||
}
|
||||
case .error(let error):
|
||||
print(error)
|
||||
@@ -378,10 +384,14 @@ extension ConvoViewModel: AgoraRtcEngineDelegate {
|
||||
|
||||
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int) {
|
||||
print("new user joined \(uid)")
|
||||
|
||||
self.playJoinAudioEffect(engine: engine)
|
||||
}
|
||||
|
||||
func rtcEngine(_ engine: AgoraRtcEngineKit, didOfflineOfUid uid: UInt, reason: AgoraUserOfflineReason) {
|
||||
print("user joined left")
|
||||
print("a user left")
|
||||
|
||||
self.playLeaveAudioEffect(engine: engine)
|
||||
}
|
||||
|
||||
func rtcEngine(_ engine: AgoraRtcEngineKit, didOccurWarning warningCode: AgoraWarningCode) {
|
||||
|
||||
@@ -331,7 +331,7 @@ struct CircleGridView: View {
|
||||
scrollReaderValue.scrollTo(self.selectedFriendIndex)
|
||||
}
|
||||
|
||||
self.animateLiveConvos = true
|
||||
self.animateLiveConvos = true
|
||||
}
|
||||
} // scrollview reader
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user