summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-21 21:25:57 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-21 21:25:57 +0200
commit79751151d57176188ed36b0d718ac3aaad641afb (patch)
tree92d6e9d0e40352a43fb5dc11ddf59efdddd6cec1 /public/bundle.js
parent4711e2988c91bdf0a70525ffe18040d1b8158b9a (diff)
save button and save videooo
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/public/bundle.js b/public/bundle.js
index 693561b..c38ea73 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -956,7 +956,7 @@ var App = function (_Component) {
(0, _preact.h)(
_button2.default,
{
- title: 'Record video',
+ title: this.props.opt.recording ? 'Recording (' + timeInSeconds(this.props.opt.recordFrames) + ')' : 'Record video',
onClick: this.toggleRecording
},
this.props.opt.recording ? 'Recording' : 'Record'
@@ -1096,6 +1096,9 @@ var App = function (_Component) {
return App;
}(_preact.Component);
+function timeInSeconds(n) {
+ return (n / 10).toFixed(1) + ' s.';
+}
var mapStateToProps = function mapStateToProps(state) {
return {
opt: state.live.opt,
@@ -1184,6 +1187,9 @@ function onFrame(data) {
if (recording) {
console.log('record frame');
videoWriter.add(canvas);
+ _store.store.dispatch({
+ type: 'ADD_RECORD_FRAME'
+ });
}
if (saving) {
saving = false;
@@ -1312,6 +1318,12 @@ var liveReducer = function liveReducer() {
recording: true
})
});
+ case 'ADD_RECORD_FRAME':
+ return _extends({}, state, {
+ opt: _extends({}, state.opt, {
+ recordFrames: (state.opt.recordFrames || 0) + 1
+ })
+ });
case 'SAVE_FRAME':
FileSaver.saveAs(action.blob, state.opt.checkpoint_name + "_" + state.opt.sequence + "_" + (0, _moment2.default)().format("YYYYMMDD_HHmm") + ".png");