Emit("plugin-crashed", info.name, info.version);
}
+void WebContents::MediaStartedPlaying() {
+ Emit("media-started-playing");
+}
+
+void WebContents::MediaPaused() {
+ Emit("media-paused");
+}
+
void WebContents::DocumentLoadedInFrame(
content::RenderFrameHost* render_frame_host) {
if (!render_frame_host->GetParent())
const std::vector<content::FaviconURL>& urls) override;
void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override;
+ void MediaStartedPlaying() override;
+ void MediaPaused() override;
// brightray::InspectableWebContentsViewDelegate:
void DevToolsFocused() override;
'page-title-updated'
'page-favicon-updated'
'enter-html-full-screen'
- 'leave-html-full-screen'
+ 'leave-html-full-screen',
+ 'media-started-playing',
+ 'media-paused',
]
nextInstanceId = 0
'crashed': []
'gpu-crashed': []
'plugin-crashed': ['name', 'version']
+ 'media-started-playing': []
+ 'media-paused': []
'destroyed': []
'page-title-updated': ['title', 'explicitSet']
'page-favicon-updated': ['favicons']
The usage is the same with [the `login` event of `app`](app.md#event-login).
+### Event: 'media-started-playing'
+
+Emitted when media starts playing.
+
+### Event: 'media-paused'
+
+Emitted when media is paused or done playing.
+
## Instance Methods
The `webContents` object has the following instance methods:
--- /dev/null
+tone.wav
+http://soundbible.com/1815-A-Tone.html
+License: Public Domain
--- /dev/null
+<audio autoplay muted src="../assets/tone.wav"></audio>
webview.src = "file://#{fixtures}/pages/onmouseup.html"
webview.setAttribute 'nodeintegration', 'on'
document.body.appendChild webview
+
+ describe 'media-started-playing media-paused events', ->
+ it 'emits when audio starts and stops playing', (done) ->
+ audioPlayed = false
+ webview.addEventListener 'media-started-playing', ->
+ audioPlayed = true
+ webview.addEventListener 'media-paused', ->
+ assert audioPlayed
+ done()
+ webview.src = "file://#{fixtures}/pages/audio.html"
+ document.body.appendChild webview