Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(copy): support copying MediaStream object
Browse files Browse the repository at this point in the history
use MediaStream clone method to clone mediastream object

Closes #16055
  • Loading branch information
m-amr committed Jun 17, 2017
1 parent e58bcfa commit dd53058
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
12 changes: 12 additions & 0 deletions test/AngularSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dd53058

Please sign in to comment.