MCPcopy Create free account
hub / github.com/Wscats/chrome-devtools-cli / WhammyRecorder

Function WhammyRecorder

src/__tests__/MediaStreamRecorder.js:1695–1753  ·  view source on GitHub ↗
(mediaStream)

Source from the content-addressed store, hash-verified

1693// WhammyRecorder.js
1694
1695function WhammyRecorder(mediaStream) {
1696 // void start(optional long timeSlice)
1697 // timestamp to fire "ondataavailable"
1698 this.start = function(timeSlice) {
1699 timeSlice = timeSlice || 1000;
1700
1701 mediaRecorder = new WhammyRecorderHelper(mediaStream, this);
1702
1703 for (var prop in this) {
1704 if (typeof this[prop] !== 'function') {
1705 mediaRecorder[prop] = this[prop];
1706 }
1707 }
1708
1709 mediaRecorder.record();
1710
1711 timeout = setInterval(function() {
1712 mediaRecorder.requestData();
1713 }, timeSlice);
1714 };
1715
1716 this.stop = function() {
1717 if (mediaRecorder) {
1718 mediaRecorder.stop();
1719 clearTimeout(timeout);
1720 this.onstop();
1721 }
1722 };
1723
1724 this.onstop = function() {};
1725
1726 this.clearOldRecordedFrames = function() {
1727 if (mediaRecorder) {
1728 mediaRecorder.clearOldRecordedFrames();
1729 }
1730 };
1731
1732 this.pause = function() {
1733 if (!mediaRecorder) {
1734 return;
1735 }
1736
1737 mediaRecorder.pause();
1738 };
1739
1740 this.resume = function() {
1741 if (!mediaRecorder) {
1742 return;
1743 }
1744
1745 mediaRecorder.resume();
1746 };
1747
1748 this.ondataavailable = function() {};
1749
1750 // Reference to "WhammyRecorder" object
1751 var mediaRecorder;
1752 var timeout;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected