Please remember this is a work in progress. Home » Controls

Controls

 

TIWAudio

 

Introduced in IntraWeb version XIV, this is a specialized control to play audio files in your IntraWeb application.

In general, you should set AudioFile and AlternateAudioFile properties, pointing to two different formats of the same audio stream. Different browsers support different audio formats. Although mp3 is considered the de facto standard, it is proprietary and some browsers don't support it. On the other hand, Ogg format is free but still not supported by all browsers. The best solution is to have both and then your user will be able to listen to the audio file in all major browsers. Check the audio format x browser compabibility table below:

Browser
MP3
OGG
WAVE
Internet Explorer 9+
X
Safari 5+
X
X
Chrome 6+
X
X
X
Firefox 3.6+
X
X
Opera 10+
X
X

As a rule of thumb, set the first to a mp3 file, and the second to a ogg file. Although wave files are also supported by some browsers, this format should be avoided because it is not compressed and the file size is much bigger.

Notes:

1) Internet Explorer 8 is not supported. This is not an IntraWeb limitation. IE 8 just doesn't support the new audio HTML tag.

2) Internet Explorer 9+ requires HTML 5 to correclty handle the audio HTML tag. This way, you must specify <!DOCTYPE HTML> in your ServerController.DocType (for the whole application), or in your IWForm.DocType (for the current form only).

Unit

IWCompAudio

Class hierarchy

TControl -> TIWVCLBaseControl -> TIWPlatformBaseControl -> TIWBaseControl -> TIWBaseHTMLControl -> TIWCustomControl -> TIWAudio

Properties

AudioFile: TIWFileReference; [Public, Read/Write]

File name or URL to the primary audio file. Some browsers only support certain types of audio files (see table and notes).

AlternateAudioFile: TIWFileReference; [Public, Read/Write]

File name or URL of the alternat audio file. Some browsers only support certain types of audio files (see table and notes).

FocusOutline: boolean; [Public, Read/Write]

Draw a outline when the control has focus.

ShowAudioPlayer: Boolean; [Public, Read/Write]

Controls if audio controls will be visible or not. If your control is invisible, you will have to control it using JavaScript.

AutoPlay: boolean; [Public, Read/Write]

If true, the audio file will start playing after page load is complete, automatically.

Loop: boolean; [Public, Read/Write]

If true, when the audio file ends it will start again, automatically.

PreLoad: boolean; [Public, Read/Write]

When true, the entire audio file will be loading during page load. Big audio files may delay the page load. Users should set this property to give best user experience.


Methods

GetAudioType [Public]

Declaration: class function GetAudioType(const AudioFileName: string): string;

Description: Returns the MIME type of the audio file, as a string, based on AudioFileName extension:

  • audio/mpeg, if the file is a mp3 audio file
  • audio/ogg, if the file is a ogg audio file
  • audio/wav, if the file is a wave audio file

Parameters:

  • AudioFileName (string): The name of the audio file

Result: MIME type of the audio file


 

Terms of Use | Privacy Statement © 2002 - 2024 Atozed Software