{"id":13692178,"url":"https://github.com/cordova-rtc/cordova-plugin-iosrtc","last_synced_at":"2025-05-14T05:10:24.505Z","repository":{"id":32250571,"uuid":"35824902","full_name":"cordova-rtc/cordova-plugin-iosrtc","owner":"cordova-rtc","description":"Cordova iOS plugin exposing the WebRTC W3C API","archived":false,"fork":false,"pushed_at":"2025-01-26T16:29:19.000Z","size":319916,"stargazers_count":692,"open_issues_count":24,"forks_count":338,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-05-01T23:05:49.715Z","etag":null,"topics":["cordova","cordova-ios","cordova-plugin-iosrtc","ios","libwebrtc","webrtc","webrtc-api","webrtc-w3c"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cordova-rtc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["hthetiot"],"custom":["https://www.paypal.me/hthetiot","sylaps.biz"]}},"created_at":"2015-05-18T15:09:19.000Z","updated_at":"2025-04-10T10:58:17.000Z","dependencies_parsed_at":"2025-02-27T08:13:56.699Z","dependency_job_id":"54ba8f5b-c48c-432f-abe9-a751b414fca8","html_url":"https://github.com/cordova-rtc/cordova-plugin-iosrtc","commit_stats":{"total_commits":1001,"total_committers":44,"mean_commits":22.75,"dds":0.3556443556443556,"last_synced_commit":"bd2a7386b6b79a7d74aa0da69c6c942807eb98c8"},"previous_names":["basquevoipmafia/cordova-plugin-iosrtc"],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordova-rtc%2Fcordova-plugin-iosrtc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordova-rtc%2Fcordova-plugin-iosrtc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordova-rtc%2Fcordova-plugin-iosrtc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordova-rtc%2Fcordova-plugin-iosrtc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cordova-rtc","download_url":"https://codeload.github.com/cordova-rtc/cordova-plugin-iosrtc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823441,"owners_count":21969847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova","cordova-ios","cordova-plugin-iosrtc","ios","libwebrtc","webrtc","webrtc-api","webrtc-w3c"],"created_at":"2024-08-02T17:00:54.521Z","updated_at":"2025-05-14T05:10:24.481Z","avatar_url":"https://github.com/cordova-rtc.png","language":"Objective-C","funding_links":["https://github.com/sponsors/hthetiot","https://www.paypal.me/hthetiot","sylaps.biz","https://www.buymeacoffee.com/hthetiot"],"categories":["Objective-C","Miscellaneous"],"sub_categories":["Tool"],"readme":"![cordova-rtc-logo](https://raw.githubusercontent.com/cordova-rtc/cordova-plugin-iosrtc/master/art/cordova-rtc-logo.png)\n\n# cordova-plugin-iosrtc\n\n[![npm version](https://img.shields.io/npm/v/cordova-plugin-iosrtc.svg?style=flat)](https://www.npmjs.com/package/cordova-plugin-iosrtc)\n[![Build Status](https://github.com/cordova-rtc/cordova-plugin-iosrtc/actions/workflows/main.yml/badge.svg)](https://github.com/cordova-rtc/cordova-plugin-iosrtc/actions/workflows/main.yml)\n\n[![NPM](https://nodei.co/npm/cordova-plugin-iosrtc.png)](https://npmjs.org/package/cordova-plugin-iosrtc)\n\n[Cordova](http://cordova.apache.org/) iOS plugin exposing the  ̶f̶u̶l̶l̶ [WebRTC W3C JavaScript APIs](http://www.w3.org/TR/webrtc/).\n\n* [Community Forum](https://github.com/cordova-rtc/cordova-plugin-iosrtc/discussions) for questions and discussions about *cordova-plugin-iosrtc*.\n* [Bug Tracker](https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues) for reporting issues and requesting new features (**please** don't use the bug tracker for questions or problems, use the mailing list instead).\n* [NPM package](https://www.npmjs.com/package/cordova-plugin-iosrtc).\n\n\n**Yet another WebRTC SDK for iOS?**\n\nAbsolutely **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.\n\n\n**Who?**\n\nThis plugin was initially developed at eFace2Face, and later maintained by the community, specially by [Saúl Ibarra Corretgé](http://bettercallsaghul.com) (_The OpenSource Warrior Who Does Not Burn_).\n\n\n## Requirements\n\nIn order to make this Cordova plugin run into a iOS application some requirements must be satisfied in both development computer and target devices:\n\n* Xcode \u003e= 13.2.1 (13C100)\n* iOS \u003e= 14.3 (run on lower versions at your own risk, don't report issues)\n* `swift-version` =\u003e 4.2\n* `cordova` \u003e= 11.0.0\n* `cordova-ios` \u003e= 6.2.0\n\n### Third-Party Supported Library\n\n* WebRTC W3C v1.0.0\n* WebRTC.framework =\u003e M87\n* Janus =\u003e 0.7.4\n* JSSip =\u003e 3.1.2\n* Sip.js =\u003e 0.15.6\n* OpenEasyrtc =\u003e 2.0.3\n* openvidu =\u003e 2.11.0\n* Ionic =\u003e v8\n* Jitsi ~ 3229\n* Apizee =\u003e 2.6.11\n* Twillio =\u003e 2.4.0\n\n## Installation\n\nWithin your Cordova project:\n\n```bash\n$ cordova plugin add cordova-plugin-iosrtc\n```\n\n(or add it into a `\u003cplugin\u003e` entry in the `config.xml` of your app).\n\n## Building\n\n* Last [Tested WebRTC.framework](./lib/WebRTC.framework/) version: M87 on cordova-plugin-iosrtc version 8.0.0+\n* [Building](docs/Building.md): Guidelines for building a Cordova iOS application including the *cordova-plugin-iosrtc* plugin.\n* [Building `libwebrtc`](docs/BuildingLibWebRTC.md): 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).\n\n## Sample Application\n\nThe `cordova-plugin-iosrtc-sample` include mutiple example for using `cordova-plugin-iosrtc` with JsSip, Janus, EasyRTC, and basic WebSocket Signaling. It's is used to test `cordova-plugin-iosrtc` new release and reproduce reported issues.\n\n- https://github.com/cordova-rtc/cordova-plugin-iosrtc-sample\n\n## Usage\n\nThe plugin exposes the `cordova.plugins.iosrtc` JavaScript namespace which contains all the WebRTC classes and functions.\n\n```javascript\n/* global RTCPeerConnection */\n\n\n//\n// Container for this sample\n//\n\nvar appContainer = document.body;\nappContainer.innerHTML = \"\";\n\n//\n// Sample getUserMedia\n//\n\n//\nvar localStream, localVideoEl;\nfunction TestGetUserMedia() {\n  localVideoEl = document.createElement('video');\n  localVideoEl.style.height = \"50vh\";\n  localVideoEl.setAttribute('autoplay', 'autoplay');\n  localVideoEl.setAttribute('playsinline', 'playsinline');\n  appContainer.appendChild(localVideoEl);\n\n  return navigator.mediaDevices.getUserMedia({\n    video: true,\n    audio: true\n    // Note: Use navigator.mediaDevices.enumerateDevices() Promise to get deviceIds\n    /*\n    video: {\n      // Test Back Camera\n      //deviceId: 'com.apple.avfoundation.avcapturedevice.built-in_video:0'\n      //sourceId: 'com.apple.avfoundation.avcapturedevice.built-in_video:0'\n      deviceId: {\n        exact: 'com.apple.avfoundation.avcapturedevice.built-in_video:0'\n      }\n      // Test FrameRate\n      frameRate:{ min: 15.0, max: 30.0 } // Note: Back camera may only support max 30 fps\n    },\n    audio: {\n      deviceId: {\n        exact: 'Built-In Microphone'\n      }\n    }*/\n  }).then(function (stream) {\n\n    console.log('getUserMedia.stream', stream);\n    console.log('getUserMedia.stream.getTracks', stream.getTracks());\n\n    // Note: Expose for debug\n    localStream = stream;\n\n    // Attach local stream to video element\n    localVideoEl.srcObject = localStream;\n\n    return localStream;\n\n  }).catch(function (err) {\n    console.log('getUserMedia.error', err, err.stack);\n  });\n}\n\n//\n// Sample RTCPeerConnection\n//\n\nvar pc1, pc2;\n\nvar peerConnectionConfig = {\n    offerToReceiveVideo: true,\n    offerToReceiveAudio: true,\n    //iceTransportPolicy: 'relay',\n    sdpSemantics: 'unified-plan',\n    //sdpSemantics: 'plan-b',\n    bundlePolicy: 'max-compat',\n    rtcpMuxPolicy: 'negotiate',\n    iceServers: [\n      {\n         urls: [\"stun:stun.stunprotocol.org\"]\n      }\n    ]\n};\n\n// This plugin handle 'addstream' and 'track' event for MediaStream creation.\nvar useTrackEvent = Object.getOwnPropertyDescriptors(RTCPeerConnection.prototype).ontrack;\n\nvar peerVideoEl, peerStream;\nfunction TestRTCPeerConnection(localStream) {\n\n  pc1 = new RTCPeerConnection(peerConnectionConfig);\n  pc2 = new RTCPeerConnection(peerConnectionConfig);\n\n  if (useTrackEvent) {\n\n    // Add local stream tracks to RTCPeerConnection\n    var localPeerStream = new MediaStream();\n    localStream.getTracks().forEach(function (track) {\n      console.log('pc1.addTrack', track, localPeerStream);\n      pc1.addTrack(track, localPeerStream);\n    });\n\n  // Note: Deprecated but supported\n  } else {\n     pc1.addStream(localStream);\n\n     // Note: Deprecated Test removeStream\n     // pc1.removeStream(pc1.getLocalStreams()[0]);\u003c\n  }\n\n  // Basic RTCPeerConnection Local WebRTC Signaling follow.\n  function onAddIceCandidate(pc, can) {\n    console.log('addIceCandidate', pc, can);\n    return can \u0026\u0026 pc.addIceCandidate(can).catch(function (err) {\n      console.log('addIceCandidateError', err);\n    });\n  }\n\n  pc1.addEventListener('icecandidate', function (e) {\n    onAddIceCandidate(pc2, e.candidate);\n  });\n\n  pc2.addEventListener('icecandidate', function (e) {\n    onAddIceCandidate(pc1, e.candidate);\n  });\n\n  function setPeerVideoStream(stream) {\n\n    // Create peer video element\n    peerVideoEl = document.createElement('video');\n    peerVideoEl.style.height = \"50vh\";\n    peerVideoEl.setAttribute('autoplay', 'autoplay');\n    peerVideoEl.setAttribute('playsinline', 'playsinline');\n    appContainer.appendChild(peerVideoEl);\n\n    // Note: Expose for debug\n    peerStream = stream;\n\n    // Attach peer stream to video element\n    peerVideoEl.srcObject = peerStream;\n  }\n\n  if (useTrackEvent) {\n    var newPeerStream;\n    pc2.addEventListener('track', function(e) {\n      console.log('pc2.track', e);\n      newPeerStream = e.streams[0] || newPeerStream || new MediaStream();\n      setPeerVideoStream(newPeerStream);\n      newPeerStream.addTrack(e.track);\n    });\n\n  // Note: Deprecated but supported\n  } else {\n    pc2.addEventListener('addstream', function(e) {\n      console.log('pc2.addStream', e);\n      setPeerVideoStream(e.stream);\n    });\n  }\n\n  pc1.addEventListener('iceconnectionstatechange', function (e) {\n    console.log('pc1.iceConnectionState', e, pc1.iceConnectionState);\n\n    if (pc1.iceConnectionState === 'completed') {\n      console.log('pc1.getSenders', pc1.getSenders());\n      console.log('pc2.getReceivers', pc2.getReceivers());\n    }\n  });\n\n  pc1.addEventListener('icegatheringstatechange', function (e) {\n    console.log('pc1.iceGatheringStateChange', e);\n  });\n\n  pc1.addEventListener('negotiationneeded', function (e) {\n    console.log('pc1.negotiatioNeeded', e);\n\n    return pc1.createOffer().then(function (d) {\n      var desc = {\n        type: d.type,\n        sdp: d.sdp\n      };\n      console.log('pc1.setLocalDescription', desc);\n      return pc1.setLocalDescription(desc);\n    }).then(function () {\n      var desc = {\n        type: pc1.localDescription.type,\n        sdp: pc1.localDescription.sdp\n      };\n      console.log('pc2.setLocalDescription', desc);\n      return pc2.setRemoteDescription(desc);\n    }).then(function () {\n      console.log('pc2.createAnswer');\n      return pc2.createAnswer();\n    }).then(function (d) {\n      var desc = {\n        type: d.type,\n        sdp: d.sdp\n      };\n      console.log('pc2.setLocalDescription', desc);\n      return pc2.setLocalDescription(d);\n    }).then(function () {\n      var desc = {\n        type: pc2.localDescription.type,\n        sdp: pc2.localDescription.sdp\n      };\n      console.log('pc1.setRemoteDescription', desc);\n      return pc1.setRemoteDescription(desc);\n    }).catch(function (err) {\n      console.log('pc1.createOffer.error', err);\n    });\n  });\n}\n\nfunction TestRTCPeerConnectionLocal() {\n\n  // Note: This allow this sample to run on any Browser\n  var cordova = window.cordova;\n  if (cordova \u0026\u0026 cordova.plugins \u0026\u0026 cordova.plugins.iosrtc) {\n\n    // Expose WebRTC and GetUserMedia SHIM as Globals (Optional)\n    // Alternatively WebRTC API will be inside cordova.plugins.iosrtc namespace\n    cordova.plugins.iosrtc.registerGlobals();\n\n    // Enable iosrtc debug (Optional)\n    cordova.plugins.iosrtc.debug.enable('*', true);\n  }\n\n  // Run sample\n  TestGetUserMedia().then(function (localStream) {\n    TestRTCPeerConnection(localStream);\n  });\n}\n\nif (document.readyState === \"complete\" || document.readyState === \"loaded\") {\n  TestRTCPeerConnectionLocal();\n} else {\n  window.addEventListener(\"DOMContentLoaded\", TestRTCPeerConnectionLocal);\n}\n\n// See ./extra/renderer-and-libwebrtc-tests.js for more samples usage.\n```\n\nIn case you'd like to expose the API in the global namespace like regular browsers you can do the following:\n\n```javascript\n// Just for Cordova apps.\ndocument.addEventListener('deviceready', function () {\n  // Just for iOS devices.\n  if (window.device.platform === 'iOS') {\n    cordova.plugins.iosrtc.registerGlobals();\n\n    // load adapter.js\n    var adapterVersion = 'latest';\n    var script = document.createElement(\"script\");\n    script.type = \"text/javascript\";\n    script.src = \"https://webrtc.github.io/adapter/adapter-\" + adapterVersion + \".js\";\n    script.async = false;\n    document.getElementsByTagName(\"head\")[0].appendChild(script);\n  }\n});\n```\n\nAnd that's all. Now you have `window.RTCPeerConnection`, `navigator.getUserMedia`, etc.\n\n\n## FAQ\n\nSee [the FAQ](FAQ.md).\n\n\n## Documentation\n\nRead the full [documentation](docs/index.md) in the *docs* folder.\n\n\n## Who Uses It\n\n[People and companies](WHO_USES_IT.md) using *cordova-plugin-iosrtc*.\n\nIf you are using the plugin we would love to [hear back from you](WHO_USES_IT.md)!\n\n\n## Known Issues\n\n\n#### iOS Safari and crash on WebSocket events\n\nDon't call plugin methods within WebSocket events (`onopen`, `onmessage`, etc). There is an issue in iOS Safari (see [issue #12](https://github.com/cordova-rtc/cordova-plugin-iosrtc/issues/12)). Instead run a `setTimeout()` within the WebSocket event if you need to call plugin methods on it.\n\nOr better yet, include the provided [ios-websocket-hack.js](extra/ios-websocket-hack.js) in your app and load into your `index.html` as follows:\n\n```\n\u003cscript src=\"cordova.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"ios-websocket-hack.min.js\"\u003e\u003c/script\u003e\n```\n\n#### HTML5 video API\n\nThere is no real media source attached to the `\u003cvideo\u003e` element so some [HTML5 video events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events) and properties are artificially emitted/set by the plugin on behalf of the video element.\n\nMethods such as `play()`, `pause()` are not implemented. In order to pause a video just set `enabled = false` on the associated `MediaStreamTrack`.\n\n#### iOS \u003e= 13.3.1 Device support\n\nTo run on Devices with iOS \u003e= 13.3.1, you need a valid Apple Developer account to sign the WebRTC dynamic frameworks for more info see https://stackoverflow.com/a/60090629/8691951\n\n## Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md).\n\n\n## Authors\n\n* [Iñaki Baz Castillo](https://inakibaz.me) (no longer active maintainer)\n* [Saúl Ibarra Corretgé](http://bettercallsaghul.com) (no longer active maintainer)\n* [Harold Thetiot](https://sylaps.com)\n\n\n### Maintainer\n\n* [Harold Thetiot](https://sylaps.com)\n\n**If you like this project you can support me.**\n\n\u003ca href=\"https://www.buymeacoffee.com/hthetiot\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-white.png\" alt=\"Buy Me A Coffee\" style=\"height: 51px !important;width: 217px !important;\" \u003e\n\u003c/a\u003e\n\n## License\n\n[MIT](./LICENSE) :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcordova-rtc%2Fcordova-plugin-iosrtc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcordova-rtc%2Fcordova-plugin-iosrtc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcordova-rtc%2Fcordova-plugin-iosrtc/lists"}