npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-webrtc

v0.1.1

Published

Cordova WebRTC Plugin

Downloads

17

Readme

WebRTC Plugin for Cordova

Dependency Status

NOTE: This project is not production ready.

This project aims to implement the full WebRTC API on Cordova.

  • Shim implementations:
    • WebRTC
      • RTCPeerConnection
      • RTCICECandidate
      • RTCSessionDescription
      • RTCDataChannel
    • getUserMedia (not really part of WebRTC, but needed to get for audio/video input)
      • MediaStream
      • MediaTrack

Supported Platforms

  • iOS6+
  • Android 4.0+ coming soon

Installation

cordova plugin add cordova-plugin-webrtc

Usage

Just use exactly the same WebRTC code as you would be using for a browser page! Bear in mind the following quirks:

  • Only use the WebRTC related APIs after getting cordova's deviceReady event.
  • Use <webrtc-video> tag instead of <video> if you dont want any video player skin to be shown. If you do that, you'll need to use el.setAttribute('src', ...) instead of el.src for the MutableObserver to detect changes in the 'src' element. Example:
// ------- for <video> tags -------
navigator.getUserMedia({video: true},
   function(stream) {
      var video = document.querySelector('video');
      video.src = URL.createObjectURL(stream);
   }, ...}
);
// ------- for <webrtc-video> tags -------
navigator.getUserMedia({video: true},
   function(stream) {
      var video = document.querySelector('webrtc-video');
      video.setAttribute('src', URL.createObjectURL(stream));
   }, ...}
);
  • Use pc.dispose() to clear the native peer connection object after closing it.

Current Limitations

  • Canvas operations not supported over the WebRTC video elements.
  • getUserMedia only returns front camera.
  • getUserMedia overrides native implementation (if it exists). Do not use it for anything else.
  • Audio tracks will be enabled even if the video tag is not in the DOM.
  • No MediaStream callbacks
  • Cannot detect javascript object garbage collection, thus everything has to be disposed manually (use obj.dispose() for that).

Implementation details

To make this implementation work almost seamless with the WebRTC standard, we use some hacks that allow us to overlay the native WebRTC video views on the page.

  • Use MutationObserver to listen for changing tags.
  • Implement MediaStream on top of Blob, so it is compatible with URL.createObjectURL.

How to build for development

You shall already have the npm tool (required for cordova). Just do:

npm install
bower install
gulp build

WebRTC working samples (tested)

As a mid-term goal, we aim to support all WebRTC samples from here, as well as the javascript AppRTC demo.

Note, the samples were only modified for its scripts only execute after cordova's deviceReady event is triggered.

Currently tested and working samples:

  • getUserMedia
    • Basic getUserMedia demo
  • RTCPeerConnection
    • Audio-only peer connection
  • RTCDataChannel
    • Transmit text

Contributing

We use the github issue tracker and pull request frameworks to accept contributions.

To do list

  • All kinds of tests
  • Support for other platforms
  • Better object cleanup
  • ...

License

This software is released under the Apache 2.0 License.

© 2015 Remotium, Inc. All rights reserved