Media

Media

User Media

Constructor

new Media(constraintsopt)

Source:
Parameters:
Name Type Attributes Default Description
constraints object <optional>
{ video: { width: { ideal: 1920 }, height: { ideal: 1080 }, facingMode: { exact: 'environment' } }, audio: false }

Methods

createVideoElement() → {HTMLVideoElement}

Source:

Create video element

Fires:
Returns:
Type
HTMLVideoElement

createVideoTexture() → {THREE.VideoTexture}

Source:

Create video texture

Returns:
Type
THREE.VideoTexture

enumerateDevices() → {Promise}

Source:

Enumerate devices

Returns:
Type
Promise

getDevices(type)

Source:

Get devices

Parameters:
Name Type Description
type string

type keyword to match device.kind

getUserMedia(constraints)

Source:

Get user media

Parameters:
Name Type Description
constraints MediaStreamConstraints

onWindowResize(event)

Source:

On window resize event

Parameters:
Name Type Description
event Event

pauseVideo()

Source:

Pause video element

playVideo()

Source:

Play video element

setMediaStream(stream)

Source:

Set media stream

Parameters:
Name Type Description
stream MediaStream

setVideDeviceIndex(index)

Source:

Set video device index

Parameters:
Name Type Description
index number

start(targetDeviceopt)

Source:

Start streaming

Parameters:
Name Type Attributes Description
targetDevice MediaDeviceInfo <optional>

stop()

Source:

Stop streaming

switchNextVideoDevice()

Source:

Switch to next available video device

Events

canplay

Source:

Video can play event

Type:
  • object