diff --git a/src/Angular.js b/src/Angular.js index 4cb891a0401e..0480d97a68ba 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1005,6 +1005,9 @@ function copy(source, destination, maxDepth) { case '[object Blob]': return new source.constructor([source], {type: source.type}); + + case '[object MediaStream]': + return source.clone(); } if (isFunction(source.cloneNode)) { diff --git a/test/AngularSpec.js b/test/AngularSpec.js index bb8ca7a8def6..8296d20a4fb1 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -603,6 +603,18 @@ describe('angular', function() { /* eslint-enable */ }); + it('should copy media stream objects', function() { + var source = new MediaStream(); + var destination = copy(source); + + expect(destination.id).toMatch(/^((\w+)-){4}(\w+)$/); + expect(typeof destination.active).toBe('boolean'); + expect(source.id).not.toBe(destination.id); + expect(source.active).toBe(destination.active); + + + }); + it('should copy source until reaching a given max depth', function() { var source = {a1: 1, b1: {b2: {b3: 1}}, c1: [1, {c2: 1}], d1: {d2: 1}}; var dest;