How to use the webtorrent.WEBRTC_SUPPORT function in webtorrent

To help you get started, we’ve selected a few webtorrent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webtorrent / instant.io / client / index.js View on Github external
function init () {
  if (!WebTorrent.WEBRTC_SUPPORT) {
    util.error('This browser is unsupported. Please use a browser with WebRTC support.')
  }

  // For performance, create the client immediately
  getClient(function () {})

  // Seed via upload input element
  var upload = document.querySelector('input[name=upload]')
  if (upload) {
    uploadElement(upload, function (err, files) {
      if (err) return util.error(err)
      files = files.map(function (file) { return file.file })
      onFiles(files)
    })
  }
github emschwartz / webtorrent-ilp / src / index.js View on Github external
peerPublicKey: peerPublicKey,
      amount: incoming.destinationAmount
    })

    // Unchoke all of this peer's wires
    for (let wire of this.peerWires[peerPublicKey]) {
      wire.unchoke()
      wire.bidAmount = wire.bidAmount.times(this.bidIncreaseFactor)
      this._checkUnchokeWire(wire)
    }
  }
}

// Note that using module.exports instead of export const here is a hack
// to make this work with https://github.com/59naga/babel-plugin-add-module-exports
module.exports.WEBRTC_SUPPORT = WebTorrent.WEBRTC_SUPPORT
github havfo / multiparty-meeting / app / lib / components / ToolArea / FileSharing / DragDropSharing.jsx View on Github external
export const configureDragDrop = () =>
{
	if (WebTorrent.WEBRTC_SUPPORT)
	{
		dragDrop('body', async (files) => await shareFiles(files));
	}
};
github havfo / multiparty-meeting / app / lib / components / FileSharing / FileEntry.jsx View on Github external
render()
	{
		return (
			<div>
				<img src="{this.props.data.picture">
	
				<div>
					{this.props.data.me ? (
						<p>You shared a file.</p>
					) : (
						<p>{this.props.data.name} shared a file.</p>
					)}

					{!this.state.active &amp;&amp; !this.state.files &amp;&amp; (
						<div>
							{WebTorrent.WEBRTC_SUPPORT ? (
								<span>
									<img src="resources/images/download-icon.svg">
								</span>
							) : (
								<p>
									Your browser does not support downloading files using WebTorrent.
								</p>
							)}

							<p>{magnet.decode(this.props.data.file.magnet).dn}</p>
						</div>
					)}

					{this.state.active &amp;&amp; this.state.numPeers === 0 &amp;&amp; (
						
							<p></p></div></div>