You can also view
You are viewing documentation for version 14. This is the most recent stable release!

Room JS Methods

You can control your <room> using our Javascript API. Below is a full list of the available methods.

How do I call methods on a room instance?
Basic Methods
connect
disconnect
publish
muteCamera
unmuteMic
muteMic
muteStream
openDeviceSettings
closeDeviceSettings
getStreams

How do I call methods on a room instance?

You can get your room's JS instance by accessing it in the CameraTag rooms array once the room has initialized. Once you have the instance you can call any of the below methods on it (in the below example we call connect() )
CameraTag.observe(YOUR_ROOM_ID, "initialized", function(){
  myroom = CameraTag.rooms["YOUR_ROOM_ID"];
  myroom.connect();
}) 
Note that the ROOM_ID listed above should match the 'id' attribute of the <room> tag and not the app id ('data-app-id') attribute.

connect()

Connect to the room (happens automatically unless a user_name is not provided or data-auto-connect="false")

disconnect()

Disconnect from the room

publish()

Start publishing your stream to the room (happens automatically unless data-auto-publish="false")

muteCamera()

Mute your own camera so others cannot see you.

muteCamera()

Unmute your own camera so others can see you.

muteMic()

Mute your own mic so others cannot hear you.

muteMic()

Unmute your own mic so others can hear you.

muteStream( stream_id )

Mute mute someone esle's stream so you cannot hear them (others in the room will still be able to hear them). You can get a list of streams using the getStreams() method.

openDeviceSettings()

Open the device selection panel

closeDeviceSettings()

Open the device selection panel

getStreams()

Get a list of streams currently in the room