cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

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
Community Support

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
Anonymous
Not applicable

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

 

Hi @Anonymous 

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?

Anonymous
Not applicable


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
Community Support

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

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

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (9,811)