OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Handles media automation events. Note that to perform any of | 6 * @fileoverview Handles media automation events. Note that to perform any of |
7 * the actions below such as ducking, and suspension of media sessions, the | 7 * the actions below such as ducking, and suspension of media sessions, the |
8 * --enable-default-media-session flag must be passed at the command line. | 8 * --enable-default-media-session flag must be passed at the command line. |
9 */ | 9 */ |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 this.mediaRoots_ = new Set(); | 29 this.mediaRoots_ = new Set(); |
30 | 30 |
31 /** @type {Date} @private */ | 31 /** @type {Date} @private */ |
32 this.lastTtsEvent_ = new Date(); | 32 this.lastTtsEvent_ = new Date(); |
33 | 33 |
34 cvox.ChromeVox.tts.addCapturingEventListener(this); | 34 cvox.ChromeVox.tts.addCapturingEventListener(this); |
35 | 35 |
36 chrome.automation.getDesktop(function(node) { | 36 chrome.automation.getDesktop(function(node) { |
37 BaseAutomationHandler.call(this, node); | 37 BaseAutomationHandler.call(this, node); |
38 | 38 |
39 this.addListener_(EventType.MEDIA_STARTED_PLAYING, | 39 var e = EventType; |
40 this.onMediaStartedPlaying); | 40 this.addListener_(e.mediaStartedPlaying, this.onMediaStartedPlaying); |
41 this.addListener_(EventType.MEDIA_STOPPED_PLAYING, | 41 this.addListener_(e.mediaStoppedPlaying, this.onMediaStoppedPlaying); |
42 this.onMediaStoppedPlaying); | |
43 }.bind(this)); | 42 }.bind(this)); |
44 }; | 43 }; |
45 | 44 |
46 /** @type {number} */ | 45 /** @type {number} */ |
47 MediaAutomationHandler.MIN_WAITTIME_MS = 1000; | 46 MediaAutomationHandler.MIN_WAITTIME_MS = 1000; |
48 | 47 |
49 MediaAutomationHandler.prototype = { | 48 MediaAutomationHandler.prototype = { |
50 __proto__: BaseAutomationHandler.prototype, | 49 __proto__: BaseAutomationHandler.prototype, |
51 | 50 |
52 /** @override */ | 51 /** @override */ |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 root.resumeMedia(); | 111 root.resumeMedia(); |
113 } | 112 } |
114 item = it.next(); | 113 item = it.next(); |
115 } | 114 } |
116 } | 115 } |
117 }; | 116 }; |
118 | 117 |
119 }); // goog.scope | 118 }); // goog.scope |
120 | 119 |
121 new MediaAutomationHandler(); | 120 new MediaAutomationHandler(); |
OLD | NEW |