Music
The component for adding a playable music file.
Declaration
object MusicProperties
| Name | Type | Description |
|---|---|---|
role Required | string | Always |
URL Required | uri | The URL of an audio file (HTTP or HTTPS only). This component supports all AVPlayer audio formats, including the following:
|
accessibilityCaption | string | A caption that describes the content of the audio file. The text is used for VoiceOver. For more information about VoiceOver, see the Vision page in Accessibility. If you don’t provide |
anchor | Anchor | An object that defines vertical alignment with another component. |
animation | (ComponentAnimation | string("none")) | An object that defines an animation you apply to the component. Use the |
behavior | (Behavior | string("none")) | An object that defines behavior for a component, like Parallax or Springy. Use the |
caption | string | A caption that describes the content of the audio file. This text is used by VoiceOver if |
conditional | (ConditionalComponent | [ConditionalComponent]) | An instance or array of component properties that you can apply conditionally, and the conditions that cause Apple News Format to apply them. |
explicitContent | boolean | A Boolean value that indicates that the audio may contain explicit content. |
hidden | boolean | A Boolean value that determines whether the component is hidden. |
identifier | string | An optional unique identifier for this component. If you use |
imageURL | uri | The URL of an image file that represents the audio file, such as a cover image. Image URLs can begin with Encode image filenames as URLs. |
layout | (ComponentLayout | string) | An inline If you don’t define |
style | (ComponentStyle | string | string("none")) | An inline Use the |
Mentioned in
Discussion
Use the Music component to play an audio file. You can also include album art (or another image that represents the music).
See Preparing Image, Video, Audio, Music, and ARKit Assets.
Example
{
"components": [
{
"role": "music",
"URL": "http://www.example.com/files/sample.mp3",
"imageURL": "bundle://album_cover.jpg",
"caption": "Cosmic-Karmic by Retake Chorus"
}
]
}