Safe Haskell | None |
---|---|
Language | Haskell98 |
High-ish level bindings to the HTML5 audio tag and JS API.
- data Audio
- data AudioSettings = AudioSettings {
- audioControls :: !Bool
- audioAutoplay :: !Bool
- audioLooping :: !Bool
- audioPreload :: !AudioPreload
- audioMuted :: !Bool
- audioVolume :: !Double
- data AudioType
- data AudioSource = AudioSource !AudioType !JSString
- data AudioPreload
- data AudioState
- data Seek
- defaultAudioSettings :: AudioSettings
- mkSource :: JSString -> Maybe AudioSource
- newAudio :: MonadIO m => AudioSettings -> [AudioSource] -> m Audio
- setSource :: MonadIO m => Audio -> AudioSource -> m ()
- getState :: MonadIO m => Audio -> m AudioState
- setMute :: MonadIO m => Audio -> Bool -> m ()
- isMute :: MonadIO m => Audio -> m Bool
- toggleMute :: MonadIO m => Audio -> m ()
- setLooping :: MonadIO m => Audio -> Bool -> m ()
- isLooping :: MonadIO m => Audio -> m Bool
- toggleLooping :: MonadIO m => Audio -> m ()
- getVolume :: MonadIO m => Audio -> m Double
- setVolume :: MonadIO m => Audio -> Double -> m ()
- modVolume :: MonadIO m => Audio -> Double -> m ()
- play :: MonadIO m => Audio -> m ()
- pause :: MonadIO m => Audio -> m ()
- stop :: MonadIO m => Audio -> m ()
- togglePlaying :: MonadIO m => Audio -> m ()
- seek :: MonadIO m => Audio -> Seek -> m ()
- getDuration :: MonadIO m => Audio -> m Double
- getCurrentTime :: MonadIO m => Audio -> m Double
Documentation
data AudioSettings Source
AudioSettings | |
|
data AudioSource Source
mkSource :: JSString -> Maybe AudioSource Source
Create an audio source with automatically detected media type, based on the given URL's file extension. Returns Nothing if the given URL has an unrecognized media type.
newAudio :: MonadIO m => AudioSettings -> [AudioSource] -> m Audio Source
Create a new audio element.
setSource :: MonadIO m => Audio -> AudioSource -> m () Source
Set the source of the given audio element.
getState :: MonadIO m => Audio -> m AudioState Source
Get the current state of the given audio object.
toggleMute :: MonadIO m => Audio -> m () Source
Mute/unmute.
setLooping :: MonadIO m => Audio -> Bool -> m () Source
Set whether the given sound should loop upon completion or not.
toggleLooping :: MonadIO m => Audio -> m () Source
Toggle looping on/off.
getVolume :: MonadIO m => Audio -> m Double Source
Get the volume for the given audio element as a value between 0 and 1.
setVolume :: MonadIO m => Audio -> Double -> m () Source
Set the volume for the given audio element. The value will be clamped to [0, 1].
modVolume :: MonadIO m => Audio -> Double -> m () Source
Modify the volume for the given audio element. The resulting volume will be clamped to [0, 1].
togglePlaying :: MonadIO m => Audio -> m () Source
If playing, stop. Otherwise, start playing.
getDuration :: MonadIO m => Audio -> m Double Source
Get the duration of the loaded sound, in seconds.
getCurrentTime :: MonadIO m => Audio -> m Double Source
Get the current play time of the loaded sound, in seconds.