cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
PytByt
Level 8

Play sound when notification is showing

Hi All..

 

I need to know how to play a sound from media control when my notification is showing up.

 

So, basically i want to play a sound when my notification is showing in the app.

 

Is this possible?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Play sound when notification is showing

Hi @PytByt ,

 

You can use below formula to achieve this. Set the OnStart property of your app to:

:

 

Set(ShowNotification,false)

And for the notification formula, change it to:

 

 

Notify("Error", Error);Set(ShowNotification,true)

 

Finally, NotificationAudio.Autoplay=

ShowNotification

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
antony1
Level: Powered On

Re: Play sound when notification is showing

Hi @PytByt,

Yes, the simplest approach is to set the autoplay property of the media control to the variable that triggers your notification.

NotificationAudio.Autoplay=

If( ShowNotification = true, true, false)


When the notification is closed or dismissed using a button you can use the reset function on the OnSelect property to end and reset the audio.

Button.OnSelect=

Reset(NotificationAudio);


You could also use the timer control if you want to limit the play duration by adjusting its autoplay property to your variable and its End property to reset the audio control.

This video from Mr. Dang outlines the process:
https://www.youtube.com/watch?v=Tm_OtW1EQZ8

Hopefully this is what you were after! 



Documentation:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-audio-video 
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-variables
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-reset

 

PytByt
Level 8

Re: Play sound when notification is showing

Hi @antony1 

Is this a variable?

Reset(NotificationAudio);

 because i mean it in literally notification, like when we use:

Notify("Error", Error);

 
Can i use this NotificationAudio.Autoplay=

If( ShowNotification = true, true, false)

 but not as a variable?

antony1
Level: Powered On

Re: Play sound when notification is showing


I personally haven't had much experience with powerapps own notifications as I have generally had to make something more customisable so some other people in the community might have a better solution.

NotificationAudio would be the name of the Audio Control


Is this a variable?

Reset(NotificationAudio);

In the case your using powerapps notification I would still approach this with a variable, for example:

UpdateContext({PlayAudio: true}); Notify("Error", Error);


On the Autoplay property of NotificationAudio you would then use the context variable:

If( PlayAudio = true, true, false)


On the OnEnd property of NotificationAudio we can then reset the variable to false so the audio can be triggered again:

UpdateContext({ PlayAudio : false})


Hopefully this helps!
Community Support Team
Community Support Team

Re: Play sound when notification is showing

Hi @PytByt ,

 

You can use below formula to achieve this. Set the OnStart property of your app to:

:

 

Set(ShowNotification,false)

And for the notification formula, change it to:

 

 

Notify("Error", Error);Set(ShowNotification,true)

 

Finally, NotificationAudio.Autoplay=

ShowNotification

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

PytByt
Level 8

Re: Play sound when notification is showing

Thank you for the solution @v-monli-msft  and @antony1 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 238 members 6,351 guests
Please welcome our newest community members: