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

Audio stream not switched from speaker #707

Closed
3 tasks done
avoylenko opened this issue Aug 28, 2021 · 6 comments
Closed
3 tasks done

Audio stream not switched from speaker #707

avoylenko opened this issue Aug 28, 2021 · 6 comments

Comments

@avoylenko
Copy link

avoylenko commented Aug 28, 2021

YOU MUST read first!

Please use Community Forum for general technical discussions and questions.

  • I have used Google with the error message or bug in association with the library and Cordova words to make sure the issue I'm reporting is only related to iOSRTC.
  • I have provided steps to reproduce (e.g. using sample app code https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample or updated extra/renderer-and-libwebrtc-tests.js file).
  • I have provided versions of third party library name, ios, Xcode and plugin version and adapter.js version if used.

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.

Versions affected

  • Cordova version (10.0.0):
  • Cordova iOS version (6.2.0):
  • Plugin version (6.0.21):
  • iOS version (14.7.1):
  • Xcode version (12.5.1):
  • WebRTC-adapter version (latest):
  • WebRTC Framework version (SIP.JS 0.20.0):

Description

Audio stream is not switched from the speaker. I tried to use cordova-plugin-audiotoggle-bluetooth plugin as well, but it acts exactly the same.

Here is my code:

$(document).ready(function () {
	document.addEventListener(
		'deviceready',
		function () {
			if (window.device && window.device.platform === 'iOS') {
				if (cordova && cordova.plugins && cordova.plugins.iosrtc) {
					cordova.plugins.iosrtc.registerGlobals();
					cordova.plugins.iosrtc.initAudioDevices();
					cordova.plugins.iosrtc.selectAudioOutput('earpiece');
				}
			}
			initSipJs();
		},
		false
	);
});

I just found suspicious errors when a MediaStream object is attached to a video element, not sure if they are related to the described issue:
2021-08-28 20:22:47.553128+0300 Nova.WebCalls[64232:10482005] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}>

I've tried to execute iosrtc.selectAudioOutput() method when the MediaStream plays but audio doesn't want to leave the speaker.

Installed plugins:
cordova-custom-config 5.1.0 "cordova-custom-config"
cordova-plugin-iosrtc 6.0.21 "iosrtc"
cordova-plugin-whitelist 1.3.5 "Whitelist"

Steps to reproduce

Expected results

Actual results

@hthetiot
Copy link
Contributor

hthetiot commented Aug 29, 2021

First of all update to 6.0.21 see #609 search for "Required client entitlement is missing" in that issue.

Second use Google search for "audio Required client entitlement is missing" for example see: https://stackoverflow.com/questions/35289918/play-audio-when-device-in-silent-mode-ios-swift/54253201 is your device is in silent mode ?

We may add the workaround from the stack overflow linked above but it's most likely something related to your environment and/or device state.

@hthetiot
Copy link
Contributor

You don't need to call "cordova.plugins.iosrtc.initAudioDevices()" unless you explicitly set initaudiodevice to false.

Secondly check this issue #654 (comment)

@avoylenko
Copy link
Author

avoylenko commented Aug 29, 2021

Second use Google search for "audio Required client entitlement is missing" for example see: https://stackoverflow.com/questions/35289918/play-audio-when-device-in-silent-mode-ios-swift/54253201 is your device is silent mode ?

No, i tried both modes and got the same result. Anyway this error does not related to the issue. I think we can ignore it.

I was able to solve the issue by installing cordova-plugin-iosrtc from the master branch and downgrading SIP.JS library version from 0.20.0 to 0.16.1. It seems like SIP.JS starting from version 0.17.0 has significant change in SessionDescriptionHandler and no longer compatible with cordova-plugin-iosrtc:
https://github.com/onsip/SIP.js/blob/master/docs/migration-0.16-0.17.md

@hthetiot do you have a free time to run some tests to check my guess?

@hthetiot
Copy link
Contributor

@hthetiot do you have a free time to run some tests to check my guess?

No, can you try 6.0.21 and not master to know if the issue has been solved in previous release already.

@hthetiot
Copy link
Contributor

Also SIP.js is originally a fork of JSSIP that in my point of view is poorly maintain compare to JSSIP, i do recommend to use JSSIP instead.

@hthetiot
Copy link
Contributor

I was able to solve the issue by installing cordova-plugin-iosrtc from the master branch and downgrading SIP.JS library version from 0.20.0 to 0.16.1.

Closing due external library issues, and not able to reproduce using iosRTC sample app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants