diff options
author | Santhosh C <csesanthosh15@gmail.com> | 2022-10-04 22:34:43 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 17:04:43 +0000 |
commit | 88c770f09950a29c4152ef0cd0ce834efe665fe2 (patch) | |
tree | dc83c66ba9123fa46fa10a9fb1d479c28dc95389 /src/models/Service.ts | |
parent | 6.2.1-nightly.8 [skip ci] (diff) | |
download | ferdium-app-88c770f09950a29c4152ef0cd0ce834efe665fe2.tar.gz ferdium-app-88c770f09950a29c4152ef0cd0ce834efe665fe2.tar.zst ferdium-app-88c770f09950a29c4152ef0cd0ce834efe665fe2.zip |
Feature: Indication Icon which service is playing media (#655)
Diffstat (limited to 'src/models/Service.ts')
-rw-r--r-- | src/models/Service.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/models/Service.ts b/src/models/Service.ts index fb594a6f4..b44e081b7 100644 --- a/src/models/Service.ts +++ b/src/models/Service.ts | |||
@@ -124,6 +124,8 @@ export default class Service { | |||
124 | 124 | ||
125 | @observable proxy: string | null = null; | 125 | @observable proxy: string | null = null; |
126 | 126 | ||
127 | @observable isMediaPlaying: boolean = false; | ||
128 | |||
127 | @action _setAutoRun() { | 129 | @action _setAutoRun() { |
128 | if (!this.isEnabled) { | 130 | if (!this.isEnabled) { |
129 | this.webview = null; | 131 | this.webview = null; |
@@ -261,6 +263,14 @@ export default class Service { | |||
261 | this.hasCrashed = true; | 263 | this.hasCrashed = true; |
262 | } | 264 | } |
263 | 265 | ||
266 | @action _didMediaPlaying(): void { | ||
267 | this.isMediaPlaying = true; | ||
268 | } | ||
269 | |||
270 | @action _didMediaPaused(): void { | ||
271 | this.isMediaPlaying = false; | ||
272 | } | ||
273 | |||
264 | @computed get shareWithWebview(): object { | 274 | @computed get shareWithWebview(): object { |
265 | return { | 275 | return { |
266 | id: this.id, | 276 | id: this.id, |
@@ -494,6 +504,16 @@ export default class Service { | |||
494 | this.webview.send('found-in-page', result); | 504 | this.webview.send('found-in-page', result); |
495 | }); | 505 | }); |
496 | 506 | ||
507 | this.webview.addEventListener('media-started-playing', event => { | ||
508 | debug('Started Playing media', this.name, event); | ||
509 | this._didMediaPlaying(); | ||
510 | }); | ||
511 | |||
512 | this.webview.addEventListener('media-paused', event => { | ||
513 | debug('Stopped Playing media', this.name, event); | ||
514 | this._didMediaPaused(); | ||
515 | }); | ||
516 | |||
497 | webviewWebContents.on('login', (event, _, authInfo, callback) => { | 517 | webviewWebContents.on('login', (event, _, authInfo, callback) => { |
498 | // const authCallback = callback; | 518 | // const authCallback = callback; |
499 | debug('browser login event', authInfo); | 519 | debug('browser login event', authInfo); |