Marks whether this stream contains an audio track.
Marks whether to enable audio processing.
Marks whether to enable acoustic echo cancellation.
The default value is true
(enable). If you wish not to enable the acoustic echo cancellation, set AEC
as false
.
Marks whether to enable audio gain control.
The default value is true
(enable). If you wish not to enable the audio gain control, set AGC
as false
.
Marks whether to enable automatic noise suppression.
The default value is true
(enable). If you wish not to enable automatic noise suppression, set ANS
as false
.
Marks whether to enable discontinuous transmission.
The default value is false
(disable). To enable the discontinuous transmission, set DTX
as true
.
Specifies the auido source of the stream.
The camera device ID retrieved from the getDevices method.
The extension ID of the Chrome screen-sharing extension.
Set this property if you use the Chrome screen-sharing extension. See Screen Sharing on Chrome for details.
The screen-sharing mode on the Firefox browser.
If you are using the Firefox browser, setting this property specifies the screen-sharing mode:
"screen"
: Share the current screen"application"
: Share all windows of an App"window"
: Share a specified window of an AppNote:
Firefox on Windows does not support the application mode.
See Screen Sharing on Firefox for details.
The microphone device ID retrieved from the getDevices method.
Marks whether the video image of the publisher is mirrored on the publisher’s webpage.
The default value is true
(except in the screen-share mode). Agora recommends enabling this function when using the front camera, and disabling it when using the rear camera.
Marks whether this stream conatains a screen-sharing track.
The stream ID.
Please set the stream ID as the user ID, which can be retrieved from the callback of Client.join.
Marks whether this stream contains a video track.
Specifies the video source of the stream.
A class defining the
spec
paramter in the createStream method.Create a Stream
You have two options to create an audio/video stream:
Set the audio, video, and screen properties
var stream = AgoraRTC.createStream({ streamID: uid, audio:true, video:true, screen:false });
Set the audioSource and videoSource properties
Compared with the first option, the audioSource and videoSource properties can specify the audio and video tracks for the stream. Use this option if you need to process the audio and video before creating the stream.
Use the
mediaStream
method to get the audio and video tracks fromMediaStreamTrack
, and then setaudioSource
andvideoSource
:navigator.mediaDevices.getUserMedia( {video: true, audio: true} ).then(function(mediaStream){ var videoSource = mediaStream.getVideoTracks()[0]; var audioSource = mediaStream.getAudioTracks()[0]; // After processing videoSource and audioSource var localStream = AgoraRTC.createStream({ videoSource: videoSource, audioSource: audioSource }); localStream.init(function(){ client.publish(localStream, function(e){ //... }); }); });
Note:
MediaStreamTrack
refers to theMediaStreamTrack
object supported by the browser. See MediaStreamTrack API for details.Currently this option only supports the Chrome brower.
Enable Screen-sharing on the Chrome Web Browser
var stream = AgoraRTC.createStream({ streamID: uid, audio:false, video:false, screen:true, extensionId:"minllpmhdgpndnkomcoccfekfegnlikg"});
Enable Screen-sharing on the Firefox Web Browser
localStream = AgoraRTC.createStream({ streamID: uid, audio: false, video: false, screen: true, mediaSource: "screen", });
For a tutorial on screen-sharing on a website, see Advanced: Screen Sharing on the Web.
Note:
Do not set
video
andscreen
astrue
at the same time.To enable screen-sharing on the Firefox browser, ensure that the
screen
property is set totrue
, and themediaSource
property has been set to specify a certain sharing mode.