miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Media

Description

 
Synopsis

Types

newtype Media Source #

Type that abstracts over Audio or Video media objects.

You can create them in the View using audio_ or video_. To get the corresponding Media object from the DOM, you can use

media <- Media <$> getElementById "myVideo"

Constructors

Media JSVal 

Instances

Instances details
ToJSVal Media Source # 
Instance details

Defined in Miso.Media

type Stream = JSVal Source #

A media Stream

Methods

canPlayType :: Media -> JSM MisoString Source #

The canPlayType method checks if the browser can play the specified audio/video type.

load :: Media -> JSM () Source #

The load method re-loads the audio/video element.

play :: Media -> JSM () Source #

The play method starts playing the current audio or video.

pause :: Media -> JSM () Source #

The pause method pauses the currently playing audio or video.

srcObject :: Stream -> Media -> JSM () Source #

Sets the srcObject on audio or video elements.

Properties

autoplay :: Media -> JSM Bool Source #

The autoplay property returns whether the audio/video should start playing as soon as it is loaded.

To set the property, use autoplay_ on the audio_ or video_ element.

controls :: Media -> JSM Bool Source #

The controls property returns whether the browser should display standard audio/video controls.

To set the property, use controls_ on the audio_ or video_ element.

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.

loop :: Media -> JSM Bool Source #

The loop property returns whether the audio/video should start playing over again when it is finished.

To set the property, use loop_ on the audio_ or video_ element.

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.

muted :: Media -> JSM Bool Source #

The muted property returns whether the audio/video should be muted (sound turned off).

To set the property, use muted_ on the audio_ or video_ element.

networkState :: Media -> JSM NetworkState Source #

The networkState property returns the current network state (activity) of the audio/video.

paused :: Media -> JSM Bool Source #

The paused property returns whether the audio/video is paused.

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.

preload :: Media -> JSM MisoString Source #

The preload property returns whether the audio/video should start loading as soon as the page loads.

To set the preload property, use preload_ on the audio_ or video_ element.

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

volume :: Media -> JSM Double Source #

The volume property returns the current volume of the audio/video.

To set the volume, use volume_ on the audio_ or video_ element.

Event Map

mediaEvents :: Events Source #

Audio video events For use with the audio and video tags.

myApp :: App Model Action
myApp = (component model update view){ events = defaultEvents <> mediaEvents }