Properties:
Name | Type | Description |
---|---|---|
attachments |
Set.<HTMLElement> | The <audio> elements this AudioTrack is currently attached to (managed by AudioTrack#attach) |
Extends
Methods
-
attach()
-
Attach the AudioTrack to a newly created <audio> element.
Returns:
- Type
- HTMLElement
Example
var audioEl = audioTrack.attach(); document.getElementById('div#audio-track-container').appendChild(audioEl);
-
attach(selector)
-
Attach the AudioTrack to a <audio> element selected by
document.querySelector
.Parameters:
Name Type Description selector
string A query selector for the <audio> element to attach to
Returns:
- Type
- HTMLElement
Example
var audioEl = audioTrack.attach('audio#audio-track');
-
attach(audio)
-
Attach the AudioTrack to an existing <audio> element.
Parameters:
Name Type Description audio
HTMLElement The <audio> element to attach to
Returns:
- Type
- HTMLElement
Example
var audioEl = document.getElementById('audio-track'); audioTrack.attach(audioEl);
-
detach(audio)
-
Detach the AudioTrack from a previously attached <audio> element.
Parameters:
Name Type Description audio
HTMLElement The <audio> element to detach from
Returns:
- Type
- HTMLElement
Example
var audioEl = document.getElementById('audio-track'); audioTrack.detach(audioEl);
-
detach(selector)
-
Detach the AudioTrack from a previously attached <audio> element selected by
document.querySelector
.Parameters:
Name Type Description selector
string A query selector for the <audio> element to detach from
Returns:
- Type
- HTMLElement
Example
var detachedAudioEl = media.detach('div#audio-track');
-
detach()
-
Detach the AudioTrack from any and all previously attached <audio> elements.
Returns:
- Type
- Array.<HTMLElement>
Example
var detachedAudioEls = audioTrack.detach();
Events
-
disabled
-
The Track was disabled. For AudioTracks this means "muted", and for VideoTracks this means "paused".
Parameters:
Name Type Description track
Track The Track that was disabled
- Inherited From:
-
enabled
-
The Track was enabled. For AudioTracks this means "unmuted", and for VideoTracks this means "unpaused".
Parameters:
Name Type Description track
Track The Track that was enabled
- Inherited From:
-
started
-
Parameters:
Name Type Description track
Track The Track that started
- Inherited From: