In this sample application we show you how to publish a Video file to an OpenTok Session. This sample creates a simple Publisher and publishes it to a Session.
As of v2.13 of opentok.js you can set a custom audio source and video source for a publisher's stream when you call OT.initPublisher()
. The custom audio and video source are MediaStreamTrack
objects. In this sample we obtain a MediaStreamTrack
from a Video Element, using the captureStream()
method to get a MediaStream
object, and then call getVideoTracks()[0]
on that object to get the video MediaStreamTrack
object and getAudioTracks()[0]
to get the audio MediaStreamTrack
object.
Enter your credentials in config.js
and the application will work.
Note: There is a devDependency
sirv-cli
in the project that is only necessary to run the demo on StackBlitz.
Important: Read the following sections of the main README file for the repository to set up and test the application:
- This sample app works on Chrome 53+. HTMLMediaElement.captureStream currently does not work in Safari, Firefox, IE or Edge browsers.