{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.MediaSource
(newMediaSource, addSourceBuffer, addSourceBuffer_,
removeSourceBuffer, endOfStream, isTypeSupported, isTypeSupported_,
setLiveSeekableRange, clearLiveSeekableRange, getSourceBuffers,
getActiveSourceBuffers, setDuration, getDuration, getReadyState,
sourceopen, sourceended, sourceclose, MediaSource(..),
gTypeMediaSource)
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
newMediaSource :: (MonadDOM m) => m MediaSource
newMediaSource
= liftDOM (MediaSource <$> new (jsg "MediaSource") ())
addSourceBuffer ::
(MonadDOM m, ToJSString type') =>
MediaSource -> type' -> m SourceBuffer
addSourceBuffer self type'
= liftDOM
((self ^. jsf "addSourceBuffer" [toJSVal type']) >>=
fromJSValUnchecked)
addSourceBuffer_ ::
(MonadDOM m, ToJSString type') => MediaSource -> type' -> m ()
addSourceBuffer_ self type'
= liftDOM (void (self ^. jsf "addSourceBuffer" [toJSVal type']))
removeSourceBuffer ::
(MonadDOM m) => MediaSource -> SourceBuffer -> m ()
removeSourceBuffer self buffer
= liftDOM
(void (self ^. jsf "removeSourceBuffer" [toJSVal buffer]))
endOfStream ::
(MonadDOM m) => MediaSource -> Maybe EndOfStreamError -> m ()
endOfStream self error
= liftDOM (void (self ^. jsf "endOfStream" [toJSVal error]))
isTypeSupported ::
(MonadDOM m, ToJSString type') => type' -> m Bool
isTypeSupported type'
= liftDOM
(((jsg "MediaSource") ^. jsf "isTypeSupported" [toJSVal type']) >>=
valToBool)
isTypeSupported_ :: (MonadDOM m, ToJSString type') => type' -> m ()
isTypeSupported_ type'
= liftDOM
(void
((jsg "MediaSource") ^. jsf "isTypeSupported" [toJSVal type']))
setLiveSeekableRange ::
(MonadDOM m) => MediaSource -> Double -> Double -> m ()
setLiveSeekableRange self start end
= liftDOM
(void
(self ^. jsf "setLiveSeekableRange" [toJSVal start, toJSVal end]))
clearLiveSeekableRange :: (MonadDOM m) => MediaSource -> m ()
clearLiveSeekableRange self
= liftDOM (void (self ^. jsf "clearLiveSeekableRange" ()))
getSourceBuffers ::
(MonadDOM m) => MediaSource -> m SourceBufferList
getSourceBuffers self
= liftDOM ((self ^. js "sourceBuffers") >>= fromJSValUnchecked)
getActiveSourceBuffers ::
(MonadDOM m) => MediaSource -> m SourceBufferList
getActiveSourceBuffers self
= liftDOM
((self ^. js "activeSourceBuffers") >>= fromJSValUnchecked)
setDuration :: (MonadDOM m) => MediaSource -> Double -> m ()
setDuration self val
= liftDOM (self ^. jss "duration" (toJSVal val))
getDuration :: (MonadDOM m) => MediaSource -> m Double
getDuration self
= liftDOM ((self ^. js "duration") >>= valToNumber)
getReadyState :: (MonadDOM m) => MediaSource -> m ReadyState
getReadyState self
= liftDOM ((self ^. js "readyState") >>= fromJSValUnchecked)
sourceopen :: EventName MediaSource onsourceopen
sourceopen = unsafeEventName (toJSString "sourceopen")
sourceended :: EventName MediaSource onsourceended
sourceended = unsafeEventName (toJSString "sourceended")
sourceclose :: EventName MediaSource onsourceclose
sourceclose = unsafeEventName (toJSString "sourceclose")