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
.
Note:
Safari does not support this setting.
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
.
Note:
Safari does not support this setting.
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
.
Note:
ANS
as false
does not take effect on Firefox.Specifies the audio source of the stream.
The camera device ID retrieved from the getDevices method.
The retrieved ID is ASCII characters, and the string length is greater than 0 and less than 256 bytes.
The extension ID of the Chrome screen-sharing extension.
ASCII characters only, and the string length must be greater than 0 and less than 256 bytes.
Set this property if you use the Chrome screen-sharing extension. See Chrome Extension for Screen Sharing 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.
The retrieved ID is ASCII characters, and the string length is greater than 0 and less than 256 bytes.
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 contains 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.
Note:
If you use a video source created by the Canvas API, re-draw on the canvas every one second when the drawing is still to keep the video publishing.
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({ video: true, audio: true, 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 Share the Screen.
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.