| Copyright | (C) 2016-2025 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <code@dmj.io> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Media
Contents
Description
Synopsis
- newtype Media = Media JSVal
- data NetworkState
- data ReadyState
- type Stream = JSVal
- canPlayType :: Media -> JSM MisoString
- load :: Media -> JSM ()
- play :: Media -> JSM ()
- pause :: Media -> JSM ()
- srcObject :: Stream -> Media -> JSM ()
- autoplay :: Media -> JSM Bool
- controls :: Media -> JSM Bool
- currentSrc :: Media -> JSM MisoString
- currentTime :: Media -> JSM Double
- defaultMuted :: Media -> JSM Bool
- defaultPlaybackRate :: Media -> JSM Double
- duration :: Media -> JSM Double
- ended :: Media -> JSM Bool
- loop :: Media -> JSM Bool
- mediaGroup :: Media -> JSM MisoString
- muted :: Media -> JSM Bool
- networkState :: Media -> JSM NetworkState
- paused :: Media -> JSM Bool
- playbackRate :: Media -> JSM Double
- poster :: Media -> JSM MisoString
- preload :: Media -> JSM MisoString
- readyState :: Media -> JSM ReadyState
- seeking :: Media -> JSM Bool
- videoHeight :: Media -> JSM Int
- videoWidth :: Media -> JSM Int
- volume :: Media -> JSM Double
- mediaEvents :: Events
Types
data NetworkState Source #
Possible values of networkState property.
Constructors
| NETWORK_EMPTY | |
| NETWORK_IDLE | |
| NETWORK_LOADING | |
| NETWORK_NO_SOURCE |
Instances
| Enum NetworkState Source # | |
Defined in Miso.Media Methods succ :: NetworkState -> NetworkState # pred :: NetworkState -> NetworkState # toEnum :: Int -> NetworkState # fromEnum :: NetworkState -> Int # enumFrom :: NetworkState -> [NetworkState] # enumFromThen :: NetworkState -> NetworkState -> [NetworkState] # enumFromTo :: NetworkState -> NetworkState -> [NetworkState] # enumFromThenTo :: NetworkState -> NetworkState -> NetworkState -> [NetworkState] # | |
| Show NetworkState Source # | |
Defined in Miso.Media Methods showsPrec :: Int -> NetworkState -> ShowS # show :: NetworkState -> String # showList :: [NetworkState] -> ShowS # | |
| Eq NetworkState Source # | |
Defined in Miso.Media | |
data ReadyState Source #
Possible values of readyState property.
Instances
| Enum ReadyState Source # | |
Defined in Miso.Media Methods succ :: ReadyState -> ReadyState # pred :: ReadyState -> ReadyState # toEnum :: Int -> ReadyState # fromEnum :: ReadyState -> Int # enumFrom :: ReadyState -> [ReadyState] # enumFromThen :: ReadyState -> ReadyState -> [ReadyState] # enumFromTo :: ReadyState -> ReadyState -> [ReadyState] # enumFromThenTo :: ReadyState -> ReadyState -> ReadyState -> [ReadyState] # | |
| Show ReadyState Source # | |
Defined in Miso.Media Methods showsPrec :: Int -> ReadyState -> ShowS # show :: ReadyState -> String # showList :: [ReadyState] -> ShowS # | |
| Eq ReadyState Source # | |
Defined in Miso.Media | |
Methods
canPlayType :: Media -> JSM MisoString Source #
The canPlayType method checks if the browser can play the specified audio/video type.
Properties
currentSrc :: Media -> JSM MisoString Source #
The currentSrc property returns the URL of the current audio/video.
currentTime :: Media -> JSM Double Source #
The currentTime property returns the current position (in seconds) of the audio/video playback.
To set the current time, use currentTime_
on the audio_ or video_ element.
defaultMuted :: Media -> JSM Bool Source #
The defaultMuted property returns whether the audio/video should be muted by default.
To set the property, use defaultMuted_
on the audio_ or video_ element.
defaultPlaybackRate :: Media -> JSM Double Source #
The defaultPlaybackRate property returns the default playback speed of the audio/video.
To set the property, use defaultPlaybackRate_
on the audio_ or video_ element.
duration :: Media -> JSM Double Source #
The duration property returns the length of the current audio/video, in seconds.
ended :: Media -> JSM Bool Source #
The ended property returns whether the playback of the audio/video has ended.
mediaGroup :: Media -> JSM MisoString Source #
The mediaGroup property returns the name of the media group the audio/video is a part of.
To set the property, use mediaGroup_
on the audio_ or video_ element.
networkState :: Media -> JSM NetworkState Source #
The networkState property returns the current network state (activity) of the audio/video.
playbackRate :: Media -> JSM Double Source #
The playbackRate property returns the current playback speed of the audio/video.
To set the playback rate, use playbackRate_
on the audio_ or video_ element.
poster :: Media -> JSM MisoString Source #
The poster property of the HTMLVideoElement interface is a string that reflects the URL for an image to be shown while no video data is available.
Specific to videos.
readyState :: Media -> JSM ReadyState Source #
The readyState property returns the current ready state of the audio/video.
seeking :: Media -> JSM Bool Source #
The seeking property returns whether the user is currently seeking in the audio/video.
videoHeight :: Media -> JSM Int Source #
The HTMLVideoElement interface's read-only videoHeight property indicates the intrinsic height of the video, expressed in CSS pixels.
videoWidth :: Media -> JSM Int Source #
The HTMLVideoElement interface's read-only videoWidth property indicates the intrinsic width of the video, expressed in CSS pixels
Event Map
mediaEvents :: Events Source #
Audio video events
For use with the audio and video tags.
myApp ::AppModel Action myApp = (componentmodel update view){ events =defaultEvents<>mediaEvents}