Skip to content

Commit

Permalink
feat: update media recorders api (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudafeng committed Dec 12, 2021
1 parent 743290e commit cf830f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ const extendsMixIn = wd => {
* @function waitForVideosSave
*/
wd.addPromiseChainMethod('waitForVideosSave', function() {
return this.execute('return window._mediaRecorders.length;')
return this.execute('return window._mediaRecorder._getMediaRecoders().length;')
.then((res) => {
const videoCounts = parseInt(res, 10);
console.log('video counts: %d', videoCounts);
Expand All @@ -474,7 +474,7 @@ const extendsMixIn = wd => {
return new Promise(resolve => {
const handle = () => {
setTimeout(() => {
this.execute('return window._mediaRecorders.length;')
this.execute('return window._mediaRecorder._getMediaRecoders().length;')
.then(res => {
const videoCounts = parseInt(res, 10);
console.log('video counts: %d', videoCounts);
Expand All @@ -496,11 +496,11 @@ const extendsMixIn = wd => {
const filepath = path.join(reportspath, 'videos', `${uuid()}.webm`);
mkdir(path.dirname(filepath));
appendToContext(context, `${path.relative(reportspath, filepath)}`);
return this.execute(`window._startMediaRecorder('${filepath}');`);
return this.execute(`window._mediaRecorder._startMediaRecorder('${filepath}');`);
});

wd.addPromiseChainMethod('stopMediaRecorder', function() {
return this.execute('window._stopMediaRecorder();');
return this.execute('window._mediaRecorder._stopMediaRecorder();');
});
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-wd",
"version": "3.3.7",
"version": "3.4.0",
"description": "Macaca wd client",
"keywords": [
"macaca",
Expand Down

0 comments on commit cf830f8

Please sign in to comment.