I’m trying to use peerjs with using ionic 5 with capacitor and angular9. All works on android and on the web. But when i build the app on ios, I reveice an " notallowederror " at the line “navigation.getUsermedia”
Apparently ios 14.3 and 14.4 still does not allow getusermedia.
On the other hand there is an iosrtc cordova plugin which would allow to obtain the stream.
So do you know if I can use this cordova plugin in an ionic capacitor application?
And if yes how ?
I have not used any of those, the cordova plugin has a sample app linked in their repository and it works fine in Capacitor, but I just ran the app, didn’t use the plugin or their API other than adding Capacitor to their sample app and running.
I have not tried the Capacitor one.
when i install cordova-plugin-iosrtc in my capacitor project with npm install cordova-plugin-iosrtc
i’ve got many errors “undefined symbol” when i build on ios like objc_class $_RTCMediaConstraints
Finally I found the solution. The plugin iosrtc works with capacitor.
We just need to add the code below in the podfile:
def disable_bitcode_for_target(target)
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
remove_cflags_matching(config.build_settings, ['-fembed-bitcode', '-fembed-bitcode-marker'])
end
end
def remove_cflags_matching(build_settings, cflags)
existing_cflags = build_settings['OTHER_CFLAGS']
removed_cflags = []
if !existing_cflags.nil?
cflags.each do |cflag|
existing_cflags.delete_if { |existing_cflag| existing_cflag == cflag && removed_cflags << cflag }
end
end
if removed_cflags.length > 0
build_settings['OTHER_CFLAGS'] = existing_cflags
end
end
post_install do |installer|
project_name = Dir.glob("*.xcodeproj").first
project = Xcodeproj::Project.open(project_name)
project.targets.each do |target|
disable_bitcode_for_target(target)
end
project.save
installer.pods_project.targets.each do |target|
disable_bitcode_for_target(target)
end
installer.pods_project.save
end