Add player motion and key controllers

This commit is contained in:
Rafostar
2020-10-12 16:25:54 +02:00
parent e2d6cc440d
commit d3e4f3bb0f
5 changed files with 46 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
const { Gio, GLib, GObject, Gst, GstPlayer } = imports.gi;
const { Gio, GLib, GObject, Gst, GstPlayer, Gtk } = imports.gi;
const ByteArray = imports.byteArray;
const Debug = imports.clapper_src.debug;
@@ -80,6 +80,12 @@ class ClapperPlayer extends GstPlayer.Player
this._trackId = 0;
this.playlist_ext = opts.playlist_ext || 'claps';
this.keyController = new Gtk.EventControllerKey();
this.motionController = new Gtk.EventControllerMotion();
this.widget.add_controller(this.keyController);
this.widget.add_controller(this.motionController);
this.connect('state-changed', this._onStateChanged.bind(this));
this.connect('uri-loaded', this._onUriLoaded.bind(this));
this.connect('end-of-stream', this._onStreamEnded.bind(this));