Playing Audio

Much like video, Yendif Player is designed to play your standard <audio> tag. The following example discusses how you can provide input via the audio tag.

<div class="yendifplayer">
  <audio>
    <source type="audio/mpeg" src="http://mysite.com/audio.mp3">
    <source type="audio/ogg" src="http://mysite.com/audio.ogg">
    <source type="audio/wav" src="http://mysite.com/audio.wav">
  </audio>
</div>

Always use a SOURCE tag inside the AUDIO tag and specify the audio TYPE. Yendif Player can then adjust the AUDIO tags as required by browser or platform.

Audio attributes

The nested AUDIO tag can accept several arguments. For example:

<audio autoplay loop>
  • autoplay - start the playback automatically.
  • loop - start playback once again from the beginning once the audio finishes.
  • preload - start pre-loading the audio in the background.

These elements are valued by both the Flash component and HTML5 audio tag.

Adding Audios through JavaScript

The following example gives an idea about adding various audio formats through javascript,

// ensure DOM is ready
$(function () {
 
  // this will install yendifplayer into an element with id="player"
  $("#player").yendifplayer ({
    audios:{
      mp3:  "http://mydomain.org/audio.mp3",
      ogg:  "http://mydomain.org/audio.ogg",
      wav:  "http://mydomain.org/audio.wav"
    }
  });

});

The player supports several configuration alternatives. Review the following table to learn about the available properties.

PropertyDescription
mp3 MP3 file path (Commonly recommended).
ogg OGG file path.
wav WAV file path.
poster Image file for the audio (Valid only in playlists).
title Title of the audio (Valid only in playlists).
description Small description for the audio (Valid only in playlists).
duration Duration of the audio (Valid only in playlists).

Mime types

Make sure that all the files are available on the server and that the server transmits them with the correct Content-Type. Depending on your server you might have to extend the .htaccess or mime.types files (Apache), use the IIS manager (Internet Information Server) or set the header via Metadata (Amazon S3).

Example .htaccess file:

AddType audio/mpeg mp3
AddType audio/mp4 m4a
AddType audio/ogg ogg
AddType audio/ogg oga
AddType audio/webm webma
AddType audio/wav wav

Business Address

PLUGINSWARE INTERACTIVE PVT LTD
Door No 2A, Venkateshwara Nagar,
1st Main Road, Velachery, Chennai,
Tamilnadu, India
Pincode: 600042
© 2013 - 2024 Pluginsware Interactive Private Limited. All Rights Reserved. The Joomla! name and logo is used under a limited license granted in the United States and other countries.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.