Publishing video from a video source other than a camera or screen

You can set the video source for a Publisher to a video MediaStreamTrack object. This lets you do the following:

  • Publish video using an HTML Canvas element as the video. You can call the captureStream() method of the HTMLCanvasElement object and call the getVideoTracks() method of the resulting CanvasCaptureMediaStream object to get a video MediaStreamTrack object.

  • Publish video from a Video element. Call the captureStream() method of an HTMLVideoElement object to obtain a MediaStream object. The getVideoTracks() method of the MediaStream object returns an array of audio MediaStreamTrack objects (usually one). You can then use the MediaStreamTrack object as the audioSource property of the options object you pass into the OT.initPublisher() method.

You can use a video MediaStreamTrack object as the videoSource property of the options object you pass into the OT.initPublisher() method. This causes the video represented by the MediaStreamTrack object to be the video source for the published stream.

Setting the video source to a MediaStreamTrack object is not supported in the Vonage video Plugin for Internet Explorer.

Publishing audio from audio source other than an microphone

You can set the audio source for a Publisher to an audio MediaStreamTrack object. This lets you do the following:

  • Publish audio from a Audio or Video element. Call the captureStream() method of an HTMLAudioElement object or an HTMLVideoElement object to obtain a MediaStream object. The getAudioTracks() method of the MediaStream object is an array of audio MediaStreamTrack objects (usually one). You can then use the MediaStreamTrack object as the audioSource property of the options object you pass into the OT.initPublisher() method.
  • Publish audio from an audio MediaStreamTrack object. For example, you can use the AudioContext object and the Web audio API to dynamically generate audio. You can then call createMediaStreamDestination().stream.getAudioTracks()[0] on the AudioContext object to get the audio MediaStreamTrack object to use as the audioSource property of the options object you pass into the OT.initPublisher() method.