cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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

 

Highlighted

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?

Highlighted
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!
Highlighted
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

Highlighted

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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