Search code examples
javascriptphplaravelvue.jspusher

The pusher notification sound is not working in the Chrome browser


The pusher notification sound is not working in the Chrome browser. I know that the order play () policy has changed. But how to bypass it and use the notification sound ?? I'm using Laravel 7 Pictures of chrome browser error

Here is my Vue js code

<script>
export default {
  props: ["dataAuthUser"],
  data() {
    return {
      unreadNotifications: "",
      //   readNotifications: "",
      user: JSON.parse(this.dataAuthUser),
      alart: new Audio("/alert/alert.mp3"),
    };
  },
  created() {
    axios
      .get("/admin/vue-notify")
      .then((res) => {
        // console.log(res);
        this.unreadNotifications = res.data.unreadNotifications;
        // this.readNotifications = res.data.readNotifications;
        // this.playSound();
      })
      .catch((err) => {});
    console.error(err);
  },
  mounted() {
    Echo.private("App.User." + this.user.id).notification((notification) => {
      this.unreadNotifications.unshift(notification);
      return this.alart.play();
    });
  },
  methods: {},
  watch: {},
};
</script>


    


Solution

  • I think this method will help you.First of all click the site information tab of your specific site

    then go to the site settings and allow the Sound of that site