Skip to content
Branch: master
Find file History
Adam Ullman
Adam Ullman Fix android cycleVideo issue
Fixed a bug where if you call cycleVideo on some android devices you get an error saying the camera is in use. It turns out we need to stop the tracks on the stream we get when we call OT.getUserMedia.

This also fixes an issue where if you click publish too soon you get an error. It disables the publish button until you can click it.
Latest commit 2c4c56d Mar 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
css Cleaning up the style a bit Oct 22, 2018
js Fix android cycleVideo issue Mar 1, 2019
test Wait 5 seconds to cycleVideo Oct 22, 2018 Remove duplicate Nov 2, 2018
index.html Now that v2.15.0 is released we can point to v2 Oct 26, 2018

OpenTok.js Publish Different Devices Sample

In this sample application we show you how to choose an initial microphone and camera to publish and then how to use the setAudioSource() and cycleVideo() methods to change the Microphone and Camera while you are publishing. It also shows you how to use the "audioLevelUpdated" Event to display a simple audio level meter to indicate to the user whether their microphone is working. This sample just creates a simple standalone Publisher without actually publishing it to a Session. To build a full application you will need to combine this with one of the other sample applications, eg. Basic Video Chat


You can see a demo of this app running at

Running the App

Known Limitations

  • setAudioSource() only works with browsers that support the replaceTrack() method. This means it will not work in Internet Explorer, Microsoft Edge, Chrome before version 65 and Safari before version 12.
  • setAudioSource() is supported in v2.15+ of opentok.js
  • cycleVideo() is supported in v2.14+ of opentok.js
You can’t perform that action at this time.