simplewebrtc / SimpleWebRTC

Simplest WebRTC ever
Other
4.65k stars 1.19k forks source link

Mobile Echo problem #760

Open adinu opened 4 years ago

adinu commented 4 years ago

hi, when i try to use the speaker of the mobile, i hear echo of myself (it also exist in the talky site)

is there an easy way to disable it? my webrtc code looks like this:

      <Provider configUrl={configUrl} userData={userData}>
      {/*
         The <RemoteAudioPlayer/> plays all remote audio, muting as needed
         to reflect if the peer muted themselves, or you've muted them locally.
         See the action `disableMedia(trackId)`.

         It is possible to adjust the volume of each peer (by default it starts at 80%).
         See the action `limitPeerVolume(peerAddress, volumeLimit)`.

         It is also possible to pick the output device used to play sound.
         See the action `setAudioOutputDevice(deviceId)`
      */}
      <RemoteAudioPlayer />

      {/*
        The <Connecting/>, <Connected/>, <Disconnected/> components allow you to create
        UI based on the client connection state. They only render themselves when the
        client is in the corresponding state.
      */}

      <Connected>
        {/*
          Request user media. In this case we are requesting audio because we include
          the `audio` attribute. Video can be requested by including the `video` attribute.

          The `auto` attribute signals to request media immediately without any UI. If `auto`
          is not provided, a UI element is rendered which can be used to trigger the request.
        */}
        <DeviceList audioInput={true} audioOutput={true} hasAudioOutput={true}>
          {({ devices }) => {
            return (
              <div></div>
            );

          }}
        </DeviceList>
        <RequestUserMedia audio auto/>

        {/*
          The <Room/> component triggers joining a room, which can include a media call and chat.

          The `name` property is *not* the identifier used for the room by other components. Instead,
          the room's messaging address is used. That can be found at `room.address`, where `room` is
          one of the properties passed to the child render function. The provided `name` value can later
          be found in `room.providedName`, but be aware that it is an unsanitized value if it can be
          set by a user.

          It is possible to lock rooms, in which case the `password` property must be set in order
          to join. See the actions `lockRoom(roomAddress, password)` and `unlockRoom(roomAddress)`.
        */}
        {currentMeetingStatus == meetingStatus.DURING && (
          <Room name={roomName} password={roomPassword}>
            {({ room, peers, localMedia, remoteMedia }) => {
              if (!room.joined) {
                return <h1>Joining room...</h1>;
              }
              return null;
            }}
          </Room>
        )}
      </Connected>
    </Provider>
zhubinsheng commented 4 years ago

Can I use echo cancellation alone?