Skip to content

Commit a5a1a33

Browse files
committed
autoplay the stream we have attached to by default
1 parent a4f5764 commit a5a1a33

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

attachstream.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
var canUseURL = typeof window.URL != 'undefined';
22

3-
module.exports = function(el, stream, callback) {
3+
module.exports = function(stream, el, opts, callback) {
4+
5+
if (typeof opts == 'function') {
6+
callback = opts;
7+
opts = {};
8+
}
49

510
function ready() {
11+
var autoplay = (opts || {}).autoplay;
12+
613
el.removeEventListener('canplay', ready);
714
el.removeEventListener('loadedmetadata', ready);
15+
16+
if (typeof autoplay == 'undefined' || autoplay) {
17+
el.play();
18+
}
19+
20+
callback();
821
}
922

1023
// check for srcObject

0 commit comments

Comments
 (0)