Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification sound request #53

Open
DiegoFleitas opened this issue Feb 17, 2017 · 0 comments
Open

Notification sound request #53

DiegoFleitas opened this issue Feb 17, 2017 · 0 comments

Comments

@DiegoFleitas
Copy link

DiegoFleitas commented Feb 17, 2017

It works! I can even drag images from the download popup

But I wish it had a "Notification sound" switch, independient from that "Download Completion Notification" because I want sound to play but nothing to appear on my screen.

Here's some pseudocode from an extension I put together a while ago that does it

Great extension, thanks for doing this

//Reproduce mp3
function playSound() {
		var myAudio = new Audio();
		myAudio.src = chrome.extension.getURL("sound/notification2.mp3");
		var playPromise = myAudio.play();

		// In browsers that don’t yet support this functionality,
		// playPromise won’t be defined.
		if (playPromise !== undefined) {
		  playPromise.then(function() {
			// Automatic playback started!
		  }).catch(function(error) {
			// Automatic playback failed.
			// Show a UI element to let the user manually start playback.
		  });
		}
}

var cd = chrome.downloads;
if(typeof cd !== "undefined"){
	cd.onChanged.addListener(function(delta){
	  if (delta.state && delta.state.current === "complete")
		  playSound();
	});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant