diff --git a/src/chrome/ScreenCaptureButtons.js b/src/chrome/ScreenCaptureButtons.js index 9ff9ad732..523f376c2 100644 --- a/src/chrome/ScreenCaptureButtons.js +++ b/src/chrome/ScreenCaptureButtons.js @@ -155,13 +155,27 @@ class ScreenCaptureButtons extends Component { const videoPath = path.join(CAPTURE_LOCATION, getFileName('mp4')); this.videoPath = videoPath; if (selectedDevice instanceof AndroidDevice) { + const devicePath = '/sdcard/flipper_recorder'; + this.setState({ recording: true, }); + this.executeShell( selectedDevice, - `screenrecord --bugreport /sdcard/video.mp4`, + `mkdir -p "${devicePath}" && touch "${devicePath}/.nomedia"`, ) + .then(output => { + if (output) { + throw output; + } + }) + .then(() => + this.executeShell( + selectedDevice, + `screenrecord --bugreport "${devicePath}/video.mp4"`, + ), + ) .then(output => { if (output) { throw output; @@ -174,17 +188,19 @@ class ScreenCaptureButtons extends Component { }); }) .then( - (): Promise => { - return this.pullFromDevice( + (): Promise => + this.pullFromDevice( selectedDevice, - `/sdcard/video.mp4`, + `${devicePath}/video.mp4`, videoPath, - ); - }, + ), ) .then(openFile) - .then(() => { - this.executeShell(selectedDevice, `rm /sdcard/video.mp4`); + .then(() => this.executeShell(selectedDevice, `rm -rf "${devicePath}"`)) + .then(output => { + if (output) { + throw output; + } }) .then(() => { this.setState({