title: Play a sound with Firebase when browser receives a notification while running in the background
body: <p>I would like to know how to play a sound with Firebase Cloud Messaging (FCM) 
  when the web browser such as Chrome, Firefox, etc. receives a notification message while running in the background.</p>
  
  <p>notification while running in the background
  <a href="https://i.stack.imgur.com/bTCQm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bTCQm.png" alt="enter image description here"></a>
  To receive a message while the app is in the background, in FCM, call <code>setBackgroundMessageHandler</code> in the service worker <code>firebase-messaging-sw.js</code></p>
  
  <pre><code> messaging.setBackgroundMessageHandler(function(payload) {
        console.log('[firebase-messaging-sw.js] Received background message ', payload);
        ...
        return self.registration.showNotification(notificationTitle, notificationOptions);
      });
  </code></pre>
  
  <p>However, Audio Object <code>window.AudioContext</code> can not be called in service worker. In addition, The notification property <a href="https://developer.mozilla.org/en-US/docs/Web/API/notification/sound" rel="noreferrer"><code>Notification.sound</code></a> is not currently supported in any browser. </p>
  
  <p>I would like to know how to play a sound with FCM when the app is in the background.</p>