{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.MediaController
(newMediaController, play, pause, unpause, getBuffered,
getSeekable, getDuration, setCurrentTime, getCurrentTime,
getPaused, getPlayed, getPlaybackState, setDefaultPlaybackRate,
getDefaultPlaybackRate, setPlaybackRate, getPlaybackRate,
setVolume, getVolume, setMuted, getMuted, MediaController(..),
gTypeMediaController)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newMediaController :: (MonadDOM m) => m MediaController
newMediaController
= liftDOM (MediaController <$> new (jsg "MediaController") ())
play :: (MonadDOM m) => MediaController -> m ()
play self = liftDOM (void (self ^. jsf "play" ()))
pause :: (MonadDOM m) => MediaController -> m ()
pause self = liftDOM (void (self ^. jsf "pause" ()))
unpause :: (MonadDOM m) => MediaController -> m ()
unpause self = liftDOM (void (self ^. jsf "unpause" ()))
getBuffered :: (MonadDOM m) => MediaController -> m TimeRanges
getBuffered self
= liftDOM ((self ^. js "buffered") >>= fromJSValUnchecked)
getSeekable :: (MonadDOM m) => MediaController -> m TimeRanges
getSeekable self
= liftDOM ((self ^. js "seekable") >>= fromJSValUnchecked)
getDuration :: (MonadDOM m) => MediaController -> m Double
getDuration self
= liftDOM ((self ^. js "duration") >>= valToNumber)
setCurrentTime :: (MonadDOM m) => MediaController -> Double -> m ()
setCurrentTime self val
= liftDOM (self ^. jss "currentTime" (toJSVal val))
getCurrentTime :: (MonadDOM m) => MediaController -> m Double
getCurrentTime self
= liftDOM ((self ^. js "currentTime") >>= valToNumber)
getPaused :: (MonadDOM m) => MediaController -> m Bool
getPaused self = liftDOM ((self ^. js "paused") >>= valToBool)
getPlayed :: (MonadDOM m) => MediaController -> m TimeRanges
getPlayed self
= liftDOM ((self ^. js "played") >>= fromJSValUnchecked)
getPlaybackState ::
(MonadDOM m, FromJSString result) => MediaController -> m result
getPlaybackState self
= liftDOM ((self ^. js "playbackState") >>= fromJSValUnchecked)
setDefaultPlaybackRate ::
(MonadDOM m) => MediaController -> Double -> m ()
setDefaultPlaybackRate self val
= liftDOM (self ^. jss "defaultPlaybackRate" (toJSVal val))
getDefaultPlaybackRate ::
(MonadDOM m) => MediaController -> m Double
getDefaultPlaybackRate self
= liftDOM ((self ^. js "defaultPlaybackRate") >>= valToNumber)
setPlaybackRate ::
(MonadDOM m) => MediaController -> Double -> m ()
setPlaybackRate self val
= liftDOM (self ^. jss "playbackRate" (toJSVal val))
getPlaybackRate :: (MonadDOM m) => MediaController -> m Double
getPlaybackRate self
= liftDOM ((self ^. js "playbackRate") >>= valToNumber)
setVolume :: (MonadDOM m) => MediaController -> Double -> m ()
setVolume self val = liftDOM (self ^. jss "volume" (toJSVal val))
getVolume :: (MonadDOM m) => MediaController -> m Double
getVolume self = liftDOM ((self ^. js "volume") >>= valToNumber)
setMuted :: (MonadDOM m) => MediaController -> Bool -> m ()
setMuted self val = liftDOM (self ^. jss "muted" (toJSVal val))
getMuted :: (MonadDOM m) => MediaController -> m Bool
getMuted self = liftDOM ((self ^. js "muted") >>= valToBool)