EN
Данное содержимое не доступно на вашем языке, используйте версию на английском языке.

audio

Applies to Windows and Windows Phone

Specifies a sound to play when a toast notification is displayed. This element also allows you to mute any toast notification audio.

Element hierarchy

<toast>
<audio>

Syntax

<audio src?    = string
       loop?   = boolean
       silent? = boolean />

Key

?   optional (zero or one)

Attributes and Elements

Attributes

AttributeDescriptionData typeRequiredDefault value
loop

Set to true if the sound should repeat as long as the toast is shown; false to play only once. If this attribute is set to true, the duration attribute in the toast element must also be set. There are specific sounds provided to be used when looping. Note that neither looping audio nor long-duration toasts are not supported on Windows Phone 8.1.

booleanNofalse
silent

True to mute the sound; false to allow the toast notification sound to play.

booleanNofalse
src

The media file to play in place of the default sound. On Windows, this attribute can have one of the following string values:

  • ms-winsoundevent:Notification.Default
  • ms-winsoundevent:Notification.IM
  • ms-winsoundevent:Notification.Mail
  • ms-winsoundevent:Notification.Reminder
  • ms-winsoundevent:Notification.SMS
  • ms-winsoundevent:Notification.Looping.Alarm
  • ms-winsoundevent:Notification.Looping.Alarm2
  • ms-winsoundevent:Notification.Looping.Alarm3
  • ms-winsoundevent:Notification.Looping.Alarm4
  • ms-winsoundevent:Notification.Looping.Alarm5
  • ms-winsoundevent:Notification.Looping.Alarm6
  • ms-winsoundevent:Notification.Looping.Alarm7
  • ms-winsoundevent:Notification.Looping.Alarm8
  • ms-winsoundevent:Notification.Looping.Alarm9
  • ms-winsoundevent:Notification.Looping.Alarm10
  • ms-winsoundevent:Notification.Looping.Call
  • ms-winsoundevent:Notification.Looping.Call2
  • ms-winsoundevent:Notification.Looping.Call3
  • ms-winsoundevent:Notification.Looping.Call4
  • ms-winsoundevent:Notification.Looping.Call5
  • ms-winsoundevent:Notification.Looping.Call6
  • ms-winsoundevent:Notification.Looping.Call7
  • ms-winsoundevent:Notification.Looping.Call8
  • ms-winsoundevent:Notification.Looping.Call9
  • ms-winsoundevent:Notification.Looping.Call10

On Windows Phone 8.1, this attribute can also contain the path to a local audio file, with one of the following prefixes:

  • ms-appx:///
  • ms-appdata:///
stringNoNone

 

Child Elements

None.

Parent Elements

Parent ElementDescription
toast

Base toast element, which contains at least a single visual element.

 

Remarks

If you do not supply audio information through this tag, supply an invalid source value, or supply a value that is not supported on a particular platform such as Windows Phone 8.1, the default sound will play.

Select a sound that matches your scenario. If none of the Windows-provided sounds suit your scenario, use the default sound on Windows or supply a custom sound on Windows Phone 8.1.

Examples

The following code shows an example of this tag.



<audio src="ms-winsoundevent:Notification.Mail" loop="false"/>
                

The following code shows this tag used to mute toast notification audio.



<audio silent="true"/>
                

Requirements

Namespace

http://schemas.microsoft.com/notifications/2012/toast.xsd

 

 

Показ:
© 2015 Microsoft