Scripting for Multimedia LECTURE 17: PLAYING AUDIO Audio formats - - PowerPoint PPT Presentation

scripting for multimedia
SMART_READER_LITE
LIVE PREVIEW

Scripting for Multimedia LECTURE 17: PLAYING AUDIO Audio formats - - PowerPoint PPT Presentation

Scripting for Multimedia LECTURE 17: PLAYING AUDIO Audio formats The most common formats Ogg/Vorbis (.oga, .ogg extension) MP3 (.mp3 extension) MP4 (.mp4, .mp4a, .aac extension) WAV (.wav extension) The <audio> elements


slide-1
SLIDE 1

Scripting for Multimedia

LECTURE 17: PLAYING AUDIO

slide-2
SLIDE 2

Audio formats

  • The most common formats
  • Ogg/Vorbis (.oga, .ogg extension)
  • MP3 (.mp3 extension)
  • MP4 (.mp4, .mp4a, .aac extension)
  • WAV (.wav extension)
slide-3
SLIDE 3

The <audio> elements

  • It is used to play audio

<audio controls="controls"> <source src="song.mp3" /> You need a browser that supports HTML5! </audio>

slide-4
SLIDE 4

Setting the source

  • The <source> element specifies an audio source
  • At a minimum, you need to set the src attribute to the URL of the video
  • There can be more than one <source> element

<audio id="audio" controls="controls"> <source src="media/kittycat.oga" type='audio/ogg; codecs="vorbis"' /> <source src="media/kittycat.wav" type='audio/wav; codecs="1"' /> <source src="media/kittycat.mp3" type='audio/mpeg; codecs="mp3"' /> </audio>

  • The recommended order
  • .oga
  • .wav
  • .mp3
slide-5
SLIDE 5

Configuring the <video> element

  • Attributes for <audio> element
  • autoplay
  • controls
  • loop
  • preload
  • src

Quick check

You want to repeat the audio continuously when it completes. Which attribute must you set?