Skip to content

Commit

Permalink
🔧 Add isCurrentlyAudible() to WebContents
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrieseberg committed Jul 10, 2018
1 parent 4ebe716 commit 555d883
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions atom/browser/api/atom_api_web_contents.cc
Expand Up @@ -1434,6 +1434,10 @@ bool WebContents::IsAudioMuted() {
return web_contents()->IsAudioMuted();
}

bool WebContents::IsCurrentlyAudible() {
return web_contents()->IsCurrentlyAudible();
}

void WebContents::Print(mate::Arguments* args) {
PrintSettings settings = {false, false, base::string16()};
if (args->Length() >= 1 && !args->GetNext(&settings)) {
Expand Down Expand Up @@ -2018,6 +2022,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setIgnoreMenuShortcuts", &WebContents::SetIgnoreMenuShortcuts)
.SetMethod("setAudioMuted", &WebContents::SetAudioMuted)
.SetMethod("isAudioMuted", &WebContents::IsAudioMuted)
.SetMethod("isCurrentlyAudible", &WebContents::IsCurrentlyAudible)
.SetMethod("undo", &WebContents::Undo)
.SetMethod("redo", &WebContents::Redo)
.SetMethod("cut", &WebContents::Cut)
Expand Down
1 change: 1 addition & 0 deletions atom/browser/api/atom_api_web_contents.h
Expand Up @@ -143,6 +143,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void SetIgnoreMenuShortcuts(bool ignore);
void SetAudioMuted(bool muted);
bool IsAudioMuted();
bool IsCurrentlyAudible();
void Print(mate::Arguments* args);
std::vector<printing::PrinterBasicInfo> GetPrinterList();
void SetEmbedder(const WebContents* embedder);
Expand Down
4 changes: 4 additions & 0 deletions docs/api/web-contents.md
Expand Up @@ -832,6 +832,10 @@ Mute the audio on the current web page.

Returns `Boolean` - Whether this page has been muted.

#### `contents.isCurrentlyAudible()`

Returns `Boolean` - Whether audio is currently playing.

#### `contents.setZoomFactor(factor)`

* `factor` Number - Zoom factor.
Expand Down
4 changes: 4 additions & 0 deletions docs/api/webview-tag.md
Expand Up @@ -450,6 +450,10 @@ Set guest page muted.

Returns `Boolean` - Whether guest page has been muted.

#### `<webview>.isCurrentlyAudible()`

Returns `Boolean` - Whether audio is currently playing.

### `<webview>.undo()`

Executes editing command `undo` in page.
Expand Down
1 change: 1 addition & 0 deletions lib/renderer/web-view/web-view.js
Expand Up @@ -344,6 +344,7 @@ const registerWebViewElement = function () {
'inspectElement',
'setAudioMuted',
'isAudioMuted',
'isCurrentlyAudible',
'undo',
'redo',
'cut',
Expand Down

0 comments on commit 555d883

Please sign in to comment.