Audio
API reference › HTML › Embedded › Audio
Renders the HTML <audio> element for embedding audio content.
Supports the experimental disableremoteplayback attribute. Availability and behavior may vary across browsers.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/audio (BaseBlock for the base implementation.).
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$attributes protected | mixed[] | HTML attributes array used by the implementing class. Default: []. | UIAwesome\ |
$content protected | string | Content string assigned to the element. Default: ''. | UIAwesome\ |
Methods
Section titled “Methods”Method details
Section titled “Method details”autoplay()
Section titled “autoplay() ”public function autoplay(bool $value): staticSets the autoplay attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether media should automatically begin playback when it can. |
Returns
static: New instance with the updated autoplay attribute.
controls()
Section titled “controls() ”public function controls(bool $value): staticSets the controls attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether browser playback controls should be displayed. |
Returns
static: New instance with the updated controls attribute.
controlslist()
Section titled “controlslist() ”public function controlslist(string|UnitEnum|null $value): staticSets the controlslist attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|UnitEnum| | Controls list token(s), or null to remove the attribute. |
Returns
static: New instance with the updated controlslist attribute. Controlslist for predefined enum values.
Throws
InvalidArgumentException: if the provided value is not valid.
disableremoteplayback()
Section titled “disableremoteplayback() ”public function disableremoteplayback(bool $value): staticSets the disableremoteplayback attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether remote playback should be disabled. |
Returns
static: New instance with the updated disableremoteplayback attribute.
loop()
Section titled “loop() ”public function loop(bool $value): staticSets the loop attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether media should restart automatically when playback reaches the end. |
Returns
static: New instance with the updated loop attribute.
muted()
Section titled “muted() ”public function muted(bool $value): staticSets the muted attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether media output should be initially muted. |
Returns
static: New instance with the updated muted attribute.
preload()
Section titled “preload() ”public function preload(string|UnitEnum|null $value): staticSets the preload attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|UnitEnum| | Preload hint (‘none’, ‘metadata’, or ‘auto’), or null to remove the attribute. |
Returns
static: New instance with the updated preload attribute. Preload for predefined enum values.
Throws
InvalidArgumentException: if the provided value is not valid.
src()
Section titled “src() ”public function src(string|Stringable|UnitEnum|null $value): staticSets the src attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Image source URL or path, or null to remove the attribute. |
Returns
static: New instance with the updated src attribute.
getTag()
Section titled “getTag() ”protected function getTag(): UIAwesome\Html\Interop\BlockReturns the tag enumeration for the <audio> element.