You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An optional string containing the URL of an audio file to be associated with the new audio element.
33
-
> -__param.volume?__: _number_
34
-
A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).
35
-
> -__param.loop?__: _boolean_
36
-
A boolean that reflects the loop HTML attribute, which indicates whether the media element should start over when it reaches the end.
37
-
> -__param.defaultMuted?__: _boolean_
38
-
A boolean that reflects the muted HTML attribute, which indicates whether the media element's audio output should be muted by default.
39
-
> -__param.autoPlay?__: _boolean_
40
-
A boolean value that reflects the autoplay HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption.
41
-
> -__param.playbackRate?__: _number_
42
-
A double that indicates the rate at which the media is being played back.
43
-
> -__param.onError] ?__: _OnErrorEventHandler_
31
+
Media HTML Attributes of an html audio element.
44
32
>
45
33
46
34
> ### Returns
47
35
>
48
36
> __result__: _UseAudioResult_
49
37
> Object with these properties:
50
38
> -__state__: object with current audio properties:
51
-
> - _status_: value between __"unavailable"__ __"ready"__ __"playing"__ __"pause"__ indicating current audio status.
52
-
> - _volume_: current audio volume.
53
-
> - _playbackRate_: current audio playbackRate.
54
-
> -__setAudio__: function to set audio.
55
-
> -__setPlaybackRate__: function to set audio playbackRate.
56
-
> -__setVolume__: function to set audio volume.
57
-
> -__play__: function to play audio.
58
-
> -__pause__: function to pause audio.
59
-
> -__load__: function to reload audio.
39
+
> - _buffered_: array of objects, with __start__ and __end__ properties, or null. It indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed.
40
+
> undefined
41
+
> undefined
42
+
> undefined
43
+
> undefined
44
+
> undefined
45
+
> undefined
46
+
> undefined
47
+
> -__controls__: object with current audio properties:
48
+
> - _play_: function to set audio.
49
+
> - _pause_: function to pause audio.
50
+
> - _mute_: function to mute audio.
51
+
> - _unmute_: function to unmute audio.
52
+
> - _playbackRate_: function to set audio playbackRate.
53
+
> - _volume_: function to set audio volume.
54
+
> - _seek_: function to seek to the given time with low precision.
> -__state__: object with current video properties:
39
+
> - _buffered_: array of objects, with __start__ and __end__ properties, or null. It indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed.
40
+
> undefined
41
+
> undefined
42
+
> undefined
43
+
> undefined
44
+
> undefined
45
+
> undefined
46
+
> undefined
47
+
> -__controls__: object with current video properties:
48
+
> - _play_: function to set video.
49
+
> - _pause_: function to pause video.
50
+
> - _mute_: function to mute video.
51
+
> - _unmute_: function to unmute video.
52
+
> - _playbackRate_: function to set video playbackRate.
53
+
> - _volume_: function to set video volume.
54
+
> - _seek_: function to seek to the given time with low precision.
* @param {string} [param.url] - An optional string containing the URL of an audio file to be associated with the new audio element.
9
-
* @param {number} [param.volume] - A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).
10
-
* @param {boolean} [param.loop] - A boolean that reflects the loop HTML attribute, which indicates whether the media element should start over when it reaches the end.
11
-
* @param {boolean} [param.defaultMuted] - A boolean that reflects the muted HTML attribute, which indicates whether the media element's audio output should be muted by default.
12
-
* @param {number} [param.playbackRate] - A double that indicates the rate at which the media is being played back.
13
-
* @param {OnErrorEventHandler} [param.onError] -
4
+
* **`useAudio`**: Hook to use an HTML audio element.
5
+
* @param {UseAudioProps} param - Media HTML Attributes of an html audio element.
14
6
* @returns {UseAudioResult} result
15
7
* Object with these properties:
16
8
* - __state__: object with current audio properties:
17
-
* - _status_: value between __"unavailable"__ __"ready"__ __"playing"__ __"pause"__ indicating current audio status.
18
-
* - _volume_: current audio volume.
19
-
* - _playbackRate_: current audio playbackRate.
20
-
* - __setAudio__: function to set audio.
21
-
* - __setPlaybackRate__: function to set audio playbackRate.
22
-
* - __setVolume__: function to set audio volume.
23
-
* - __play__: function to play audio.
24
-
* - __pause__: function to pause audio.
25
-
* - __load__: function to reload audio.
9
+
* - _buffered_: array of objects, with __start__ and __end__ properties, or null. It indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed.
10
+
- _duration_: a read-only double-precision floating-point value indicating the total duration of the media in seconds. If no media data is available, the returned value is NaN.
11
+
- _paused_: returns a boolean that indicates whether the media element is paused.
12
+
- _muted_: boolean that determines whether audio is muted. true if the audio is muted and false otherwise.
13
+
- _time_: value indicating the current playback time in seconds; if the media has not started to play and has not been seeked, this value is the media's initial playback time. Setting this value seeks the media to the new time. The time is specified relative to the media's timeline.
14
+
- _volume_: double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).
15
+
- _playbackRate_: double that indicates the rate at which the media is being played back.
16
+
- _playing_: boolean indicating if audio is playing or not.
17
+
* - __controls__: object with current audio properties:
18
+
* - _play_: function to set audio.
19
+
* - _pause_: function to pause audio.
20
+
* - _mute_: function to mute audio.
21
+
* - _unmute_: function to unmute audio.
22
+
* - _playbackRate_: function to set audio playbackRate.
23
+
* - _volume_: function to set audio volume.
24
+
* - _seek_: function to seek to the given time with low precision.
0 commit comments