[gnome-sound-recorder/bilelmoussaoui/misc: 4/6] recorder: add a pause/resume methods



commit 14206897eba0c28b79d1a830ab8ce7ac33d255db
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sun Jun 14 15:34:27 2020 +0200

    recorder: add a pause/resume methods

 src/mainWindow.js | 4 ++--
 src/recorder.js   | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 3694a60..d7eef92 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -81,12 +81,12 @@ var MainWindow = GObject.registerClass({
     }
 
     onRecorderPause() {
-        this._recorder.state = Gst.State.PAUSED;
+        this._recorder.pause();
         this._playbackStack.set_visible_child_name('recorder-start');
     }
 
     onRecorderResume() {
-        this._recorder.state = Gst.State.PLAYING;
+        this._recorder.resume();
         this._playbackStack.set_visible_child_name('recorder-pause');
     }
 
diff --git a/src/recorder.js b/src/recorder.js
index f00e72f..daa02b6 100644
--- a/src/recorder.js
+++ b/src/recorder.js
@@ -137,6 +137,15 @@ var Recorder = new GObject.registerClass({
         });
     }
 
+    pause() {
+        this.state = Gst.State.PAUSED;
+    }
+
+    resume() {
+        if (this.state === Gst.State.PAUSED)
+            this.state = Gst.State.PLAYING;
+    }
+
     stop() {
         this.state = Gst.State.NULL;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]