&
is
browser window interface
and
represents the state and the identity of the user agent
window.navigator
Standard
Non-standard
Product
Experimental
Read only
Editable
List of devices
is
Promise returns MediaDeviceInfo
navigator.mediaDevices.enumerateDevices()
navigator.mediaDevices.enumerateDevices()
.then(function(devices) {
devices.forEach(function(device) {
console.log(device.kind + ": " + device.label +
" id = " + device.deviceId);
});
})
.catch(function(err) {
console.log(err.name + ": " + err.message);
});
Device Kind
Device ID
audioinput
audiooutput
videoinput
'default'
'communications'
'b3931bb98c3647058161f03f92a96ed7190a887b073489d5c2b30364bde6a363'
MediaStream
is
interface represents a stream of media content
new MediaStream();
await navigator.mediaDevices.getUserMedia(constraints);
is based on
MediaTrackConstraints
audio
video
echoCancellation
noiseSuppression
sampleRate
volume
aspectRatio
frameRate
height
width
<audio>
<video>
.audioTracks
.audioTracks
.videoTracks
Is a DOMString that reflects the src HTML attribute, which contains the URL of a media resource to use.
Is a MediaStream representing the media to play or that has played in the current HTMLMediaElement, or null if not assigned.
video.srcObject = newMediaStream;
video.play();
video.pause();
video.fastSeek(360);
video.captureStream();
video.videoTracks // .audioTracks
video.videoTracks[i].enabled = false; // true
.enabled
.stop()
mediaStream.getTracks().forEach((track) => {
track.enabled = false;
track.stop();
mediaStream.removeTrack(track);
});
.removeTrack()
this.peerConnection.addEventListener('track', (e: RTCMediaStreamTrackEvent) => {
this.onTrackAdd(e);
});
this.peerConnection = new RTCPeerConnection(configuration);
v=0
o=- 4 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS
m=audio 59255 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122
const sendParams: Calls.SendParameters = {
offerToReceiveAudio: true,
offerToReceiveVideo: true,
};
const offer = await this.peerConnection.createOffer(sendParams);
this._sender = this.peerConnection.addTrack(track, localStream);
this.peerConnection.removeTrack(this._sender);
this.peerConnection.createOffer();
navigator.mediaDevices.ondevicechange = () => {}