Contents

Audio

The component for adding a playable audio clip.

Declaration

object Audio

Properties

NameTypeDescription
role Requiredstring

Always audio for this component.

URL Requireduri

The URL of an audio file (http or https only). This component supports all AVPlayer audio formats, including the following:

  • MP3: MPEG-1 audio layer 3

  • AAC: MPEG-4 Advanced Audio Coding

  • ALAC: Apple Lossless

  • HE-AAC: MPEG-4 High Efficiency AAC

accessibilityCaptionstring

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 accessibilityCaption, VoiceOver uses the caption value.

anchorAnchor

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 none value for conditional design elements. Adding it here has no effect.

behavior(Behavior | string("none"))

An object that defines behavior for a component, like Parallax or Springy.

Use the none value for conditional design elements. Adding it here has no effect.

captionstring

A caption that describes the content of the audio file. This text is used by VoiceOver if accessibilityCaption is not provided, or it can be shown when the audio cannot be played. For more information about VoiceOver, see the Vision page in Accessibility.

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.

explicitContentboolean

A Boolean value that indicates the audio may contain explicit content.

hiddenboolean

A Boolean value that determines whether the component is hidden.

identifierstring

An optional unique identifier for this component. If you use identifier, it must be unique across the entire document. You need an identifier for your component if you want to anchor other components to it.

imageURLstring

The URL of an image file that represents the audio file, such as a cover image.

Image URLs can begin with http://, https://, or bundle://. If the image URL begins with bundle://, the image file must be in the same directory as the document.

Encode image filenames as URLs.

See Preparing Image, Video, Audio, Music, and ARKit Assets.

layout(ComponentLayout | string)

An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that you define at the top level of the document.

If you don’t define layout, size and position are based on various factors, such as the device type, the length of the content, and the role of this component.

style(ComponentStyle | string | string("none"))

An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that you define at the top level of the document.

Use the none value for conditional design elements. Adding it here has no effect.

Mentioned in

Discussion

Audio is the abstract definition for all audio components. You can also include an image that represents your audio file.

See Preparing Image, Video, Audio, Music, and ARKit Assets.

Example

{
  "components": [
    {
      "role": "audio",
      "URL": "http://example.com/files/sample.mp3",
      "caption": "Listen up!"
    }
  ]
}

See Also

Audio and Video