diff options
Diffstat (limited to 'src/__mocks__/attachmediastream.js')
-rw-r--r-- | src/__mocks__/attachmediastream.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/__mocks__/attachmediastream.js b/src/__mocks__/attachmediastream.js new file mode 100644 index 000000000..74178ed27 --- /dev/null +++ b/src/__mocks__/attachmediastream.js @@ -0,0 +1,17 @@ +/** + * Basic "attachmediastream" implementation without using "webrtc-adapter", as + * "browserDetails" is null in unit tests. + * + * @param {MediaStream} stream the stream to attach + * @param {HTMLElement} element the element to attach the stream to + * @param {object} options ignored + */ +export default function(stream, element, options) { + if (!element) { + element = document.createElement(options.audio ? 'audio' : 'video') + } + + element.srcObject = stream + + return element +} |