Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web users can't hear ios users, but ios users can hear web users. #25

Open
dzziwny opened this issue Oct 5, 2020 · 13 comments
Open

Web users can't hear ios users, but ios users can hear web users. #25

dzziwny opened this issue Oct 5, 2020 · 13 comments
Labels
bug Something isn't working

Comments

@dzziwny
Copy link

dzziwny commented Oct 5, 2020

Describe the bug
I have implemented agora sdk into web, using capacitorjs framework. It works fine on all devices browsers, like ios safari, android chrome, desktops etc. It also works fine on android WebView. There appeard problem on ios. In docs is written that there must be a native implementation for ios. I used sample from official agora documentation (https://github.com/AgoraIO/Basic-Audio-Call/tree/master/Group-Voice-Call/OpenVoiceCall-iOS) and it looks that ios users hear everyone else, but nobody hear ios users. What did i wrong? Is there any additional magic setting? I tested on ios 13.

Here is piece of code from my private app, where ios behavior is the same

import Foundation
import Capacitor
import AgoraRtcKit

@objc(AgoraIos)
public class AgoraIos: CAPPlugin {

    var agoraKit: AgoraRtcEngineKit!

    @objc func initialize(_ call: CAPPluginCall) {
      let appId = call.getString("appId");
      agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: appId, delegate: nil);
      call.resolve();
    }

    @objc func join(_ call: CAPPluginCall) {
        let channelName = call.getString("channelName");
        let userId = call.getString("userId");
        agoraKit.joinChannel(byToken: nil, channelId: channelName, info:nil, uid: userId) {[unowned self] (sid, uid, elapsed) -> Void in
            self.agoraKit.setEnableSpeakerphone(true);
            call.resolve();
        }
    }

    @objc func leave(_ call: CAPPluginCall) {
        agoraKit.leaveChannel(nil);
        call.resolve();
    }

    @objc func talk(_ call: CAPPluginCall) {
        agoraKit.muteLocalAudioStream(true);
        call.resolve();
    }

    @objc func mute(_ call: CAPPluginCall) {
        agoraKit.muteLocalAudioStream(false);
        call.resolve();
    }
}

To Reproduce
Steps to reproduce the behavior:

  1. Just download code from this repo and run to connect with others.

Expected behavior
It should work like web implementation.

Smartphone (please complete the following information):

  • Device: iphone 6s
  • OS: ios
  • Version 3.1.2
@dzziwny dzziwny added the bug Something isn't working label Oct 5, 2020
@plutoless
Copy link
Contributor

@dzziwny sorry for late reply. could you pls share the channel name you used for testing?

@dzziwny
Copy link
Author

dzziwny commented Oct 15, 2020 via email

@dzziwny
Copy link
Author

dzziwny commented Oct 15, 2020

I created separated repo for agora plugin wrapper for capacitorjs. There is a sample app with bug - https://github.com/dzziwny/capacitor-agora-sdk/tree/master/sample

@plutoless
Copy link
Contributor

@dzziwny try calling setChannelProfile to make the channel profile livebroadcasting. then call setClientRole to make yourself a broadcaster and see if it's now working for you.
btw "test" is a too common name, i'm trying to look for your channel in our backend, it would be helpful if you can provide test in a channel which has more unique name.

@dzziwny
Copy link
Author

dzziwny commented Nov 2, 2020

@plutoless thank for help, I have added your suggestions, now i have such error - 2020-10-29 19:45:30.216484+0000 App[1331:353091] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 87 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}. Channel name was Thursday29102020. Here is the sample app https://github.com/dzziwny/capacitor-agora-sdk/tree/master/sample

@plutoless
Copy link
Contributor

@dzziwny hi, i did a test using your app and it's working fine. are you sure you have successfully joined the channel at all?

@plutoless
Copy link
Contributor

btw i tested using web -> click JOIN CHANNEL -> make myself muted, using iOS -> click JOIN CHANNEL -> click TALK, and web can hear iOS

@plutoless
Copy link
Contributor

i did a search using "Thursday29102020" and failed to find a channel. I believe you failed to join the channel somehow. please check your join channel callback, and whether you have turned on token but failed to provide a valid one.

@dzziwny
Copy link
Author

dzziwny commented Nov 9, 2020

btw i tested using web -> click JOIN CHANNEL -> make myself muted, using iOS -> click JOIN CHANNEL -> click TALK, and web can hear iOS

Did you check on ios native app or safari on ios?

@plutoless
Copy link
Contributor

@dzziwny i checked on ios native app using your instructions on readme.

@plutoless
Copy link
Contributor

by running this
npx cap add ios
npx cap open ios + run from XCode

@tuannguyenanh177
Copy link

Hi @plutoless,

I didn't test example project yet, but as an iOS developer, after reading example code, I think you forgot ask permission to use microphone. Please try below code to require microphone's permission:

AVAudioSession.sharedInstance().requestRecordPermission { (success) in
    print(success)
}

@dzziwny
Copy link
Author

dzziwny commented Nov 13, 2020

@tuannguyenanh177 thanks, i am going to make up asking for mic permission. it seams that @plutoless is right, i was creating token in a wrong way.

thank you guys, i think we can close the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants