attachmediastream
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,12 +0,12 @@ | ||
(function(e){if("function"==typeof bootstrap)bootstrap("attachmediastream",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeAttachMediaStream=e}else"undefined"!=typeof window?window.attachMediaStream=e():global.attachMediaStream=e()})(function(){var define,ses,bootstrap,module,exports; | ||
return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){ | ||
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.attachMediaStream=e():"undefined"!=typeof global?global.attachMediaStream=e():"undefined"!=typeof self&&(self.attachMediaStream=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
module.exports = function (stream, el, options) { | ||
var item; | ||
var URL = window.URL; | ||
var element = el; | ||
var opts = { | ||
autoplay: true, | ||
mirror: false, | ||
muted: false | ||
muted: false, | ||
audio: false | ||
}; | ||
var element = el || document.createElement('video'); | ||
var item; | ||
@@ -19,5 +19,11 @@ if (options) { | ||
if (!element) { | ||
element = document.createElement(opts.audio ? 'audio' : 'video'); | ||
} else if (element.tagName.toLowerCase() === 'audio') { | ||
opts.audio = true; | ||
} | ||
if (opts.autoplay) element.autoplay = 'autoplay'; | ||
if (opts.muted) element.muted = true; | ||
if (opts.mirror) { | ||
if (!opts.audio && opts.mirror) { | ||
['', 'moz', 'webkit', 'o', 'ms'].forEach(function (prefix) { | ||
@@ -44,4 +50,5 @@ var styleName = prefix ? prefix + 'Transform' : 'transform'; | ||
},{}]},{},[1])(1) | ||
},{}]},{},[1]) | ||
(1) | ||
}); | ||
; |
module.exports = function (stream, el, options) { | ||
var item; | ||
var URL = window.URL; | ||
var element = el; | ||
var opts = { | ||
autoplay: true, | ||
mirror: false, | ||
muted: false | ||
muted: false, | ||
audio: false | ||
}; | ||
var element = el || document.createElement('video'); | ||
var item; | ||
@@ -17,5 +18,11 @@ if (options) { | ||
if (!element) { | ||
element = document.createElement(opts.audio ? 'audio' : 'video'); | ||
} else if (element.tagName.toLowerCase() === 'audio') { | ||
opts.audio = true; | ||
} | ||
if (opts.autoplay) element.autoplay = 'autoplay'; | ||
if (opts.muted) element.muted = true; | ||
if (opts.mirror) { | ||
if (!opts.audio && opts.mirror) { | ||
['', 'moz', 'webkit', 'o', 'ms'].forEach(function (prefix) { | ||
@@ -22,0 +29,0 @@ var styleName = prefix ? prefix + 'Transform' : 'transform'; |
{ | ||
"name": "attachmediastream", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "cross-browser way to attach a media stream to a video element.", | ||
@@ -5,0 +5,0 @@ "main": "attachmediastream.js", |
@@ -5,3 +5,3 @@ # attachMediaStream | ||
A tiny browser module for attaching a media stream to a video element. It handles the differences between browsers. | ||
A tiny browser module for attaching a media stream to a video (or audio) element. It handles the differences between browsers. | ||
@@ -58,3 +58,6 @@ Suitable for use with browserify/CommonJS on the client. | ||
// a user their own video. Or there will be feedback issues. | ||
muted: true | ||
muted: true, | ||
// attach as an audio element instead of video | ||
audio: false | ||
}); | ||
@@ -61,0 +64,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
11396
154
95
1