(mediaStream)
| 1693 | // WhammyRecorder.js |
| 1694 | |
| 1695 | function 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; |
nothing calls this directly
no outgoing calls
no test coverage detected