Name: cordova-plugin-iosrtc
Owner: BasqueVoIPMafia
Description: Cordova iOS plugin exposing the full WebRTC W3C JavaScript APIs
Created: 2015-05-18 15:09:19.0
Updated: 2018-01-13 14:54:23.0
Pushed: 2018-01-10 23:03:17.0
Homepage: null
Size: 160665
Language: Swift
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Cordova iOS plugin exposing the full WebRTC W3C JavaScript APIs.
Yet another WebRTC SDK for iOS?
Absolutely not. This plugin exposes the WebRTC W3C API for Cordova iOS apps (you know there is no WebRTC in iOS, right?), which means no need to learn “yet another WebRTC API” and no need to use a specific service/product/provider.
Why?
Check the release announcement at the eFace2Face site.
Who?
This plugin was initially developed at eFace2Face, and later maintained by the community, specially by Saúl Ibarra Corretgé (The OpenSource Warrior Who Does Not Burn).
In order to make this Cordova plugin run into a iOS application some requirements must be satisfied in both development computer and target devices:
cordova-ios
4.XWithin your Cordova project:
rdova plugin add cordova-plugin-iosrtc
(or add it into a <plugin>
entry in the config.xml
of your app).
libwebrtc
: Guidelines for building Google's libwebrtc with modifications needed by the cordova-plugin-iosrtc plugin (just in case you want to use a different version of libwebrtc or apply your own changes to it).The plugin exposes the cordova.plugins.iosrtc
JavaScript namespace which contains all the WebRTC classes and functions.
pc = new cordova.plugins.iosrtc.RTCPeerConnection({
eServers: []
ova.plugins.iosrtc.getUserMedia(
constraints
audio: true, video: true },
success callback
nction (stream) {
console.log('got local MediaStream: ', stream);
pc.addStream(stream);
failure callback
nction (error) {
console.error('getUserMedia failed: ', error);
In case you'd like to expose the API in the global namespace like regular browsers you can do the following:
ust for Cordova apps.
ment.addEventListener('deviceready', function () {
Just for iOS devices.
(window.device.platform === 'iOS') {
cordova.plugins.iosrtc.registerGlobals();
// load adapter.js
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "js/adapter-latest.js";
script.async = false;
document.getElementsByTagName("head")[0].appendChild(script);
And that's all. Now you have window.RTCPeerConnection
, navigator.getUserMedia
, etc.
See the FAQ.
Read the full documentation in the docs folder.
People and companies using cordova-plugin-iosrtc.
If you are using the plugin we would love to hear back from you!
Don't call plugin methods within WebSocket events (onopen
, onmessage
, etc). There is an issue in iOS Safari (see issue #12). Instead run a setTimeout()
within the WebSocket event if you need to call plugin methods on it.
Or better yet, include the provided ios-websocket-hack.js in your app and load into your index.html
as follows:
ipt src="cordova.js"></script>
ipt src="ios-websocket-hack.min.js"></script>
There is no real media source attached to the <video>
element so some HTML5 video events and properties are artificially emitted/set by the plugin on behalf of the video element.
Methods such as play()
, pause()
are not implemented. In order to pause a video just set enabled = false
on the associated MediaStreamTrack
.
See CHANGELOG.md.
MIT :)