{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.MediaStream
(newMediaStream, newMediaStream', newMediaStream'', getAudioTracks,
getAudioTracks_, getVideoTracks, getVideoTracks_, getTracks,
getTracks_, getTrackById, getTrackById_, addTrack, removeTrack,
clone, clone_, getId, getActive, addTrackEvent, removeTrackEvent,
active, inactive, MediaStream(..), gTypeMediaStream)
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
newMediaStream :: (MonadDOM m) => m MediaStream
newMediaStream
= liftDOM (MediaStream <$> new (jsg "MediaStream") ())
newMediaStream' :: (MonadDOM m) => MediaStream -> m MediaStream
newMediaStream' stream
= liftDOM
(MediaStream <$> new (jsg "MediaStream") [toJSVal stream])
newMediaStream'' ::
(MonadDOM m, IsMediaStreamTrack tracks) =>
[tracks] -> m MediaStream
newMediaStream'' tracks
= liftDOM
(MediaStream <$> new (jsg "MediaStream") [toJSVal (array tracks)])
getAudioTracks ::
(MonadDOM m) => MediaStream -> m [MediaStreamTrack]
getAudioTracks self
= liftDOM
((self ^. jsf "getAudioTracks" ()) >>= fromJSArrayUnchecked)
getAudioTracks_ :: (MonadDOM m) => MediaStream -> m ()
getAudioTracks_ self
= liftDOM (void (self ^. jsf "getAudioTracks" ()))
getVideoTracks ::
(MonadDOM m) => MediaStream -> m [MediaStreamTrack]
getVideoTracks self
= liftDOM
((self ^. jsf "getVideoTracks" ()) >>= fromJSArrayUnchecked)
getVideoTracks_ :: (MonadDOM m) => MediaStream -> m ()
getVideoTracks_ self
= liftDOM (void (self ^. jsf "getVideoTracks" ()))
getTracks :: (MonadDOM m) => MediaStream -> m [MediaStreamTrack]
getTracks self
= liftDOM ((self ^. jsf "getTracks" ()) >>= fromJSArrayUnchecked)
getTracks_ :: (MonadDOM m) => MediaStream -> m ()
getTracks_ self = liftDOM (void (self ^. jsf "getTracks" ()))
getTrackById ::
(MonadDOM m, ToJSString trackId) =>
MediaStream -> trackId -> m MediaStreamTrack
getTrackById self trackId
= liftDOM
((self ^. jsf "getTrackById" [toJSVal trackId]) >>=
fromJSValUnchecked)
getTrackById_ ::
(MonadDOM m, ToJSString trackId) => MediaStream -> trackId -> m ()
getTrackById_ self trackId
= liftDOM (void (self ^. jsf "getTrackById" [toJSVal trackId]))
addTrack ::
(MonadDOM m, IsMediaStreamTrack track) =>
MediaStream -> track -> m ()
addTrack self track
= liftDOM (void (self ^. jsf "addTrack" [toJSVal track]))
removeTrack ::
(MonadDOM m, IsMediaStreamTrack track) =>
MediaStream -> track -> m ()
removeTrack self track
= liftDOM (void (self ^. jsf "removeTrack" [toJSVal track]))
clone :: (MonadDOM m) => MediaStream -> m MediaStream
clone self
= liftDOM ((self ^. jsf "clone" ()) >>= fromJSValUnchecked)
clone_ :: (MonadDOM m) => MediaStream -> m ()
clone_ self = liftDOM (void (self ^. jsf "clone" ()))
getId ::
(MonadDOM m, FromJSString result) => MediaStream -> m result
getId self = liftDOM ((self ^. js "id") >>= fromJSValUnchecked)
getActive :: (MonadDOM m) => MediaStream -> m Bool
getActive self = liftDOM ((self ^. js "active") >>= valToBool)
addTrackEvent :: EventName MediaStream Event
addTrackEvent = unsafeEventName (toJSString "addtrack")
removeTrackEvent :: EventName MediaStream Event
removeTrackEvent = unsafeEventName (toJSString "removetrack")
active :: EventName MediaStream Event
active = unsafeEventName (toJSString "active")
inactive :: EventName MediaStream Event
inactive = unsafeEventName (toJSString "inactive")