Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
twilio-video
Advanced tools
twilio-video.js allows you to add real-time voice and video to your web apps.
We want your feedback! Email video-product@twilio.com with suggested improvements, feature requests and general feedback, or feel free to open a GitHub issue. If you need technical support, contact help@twilio.com.
Chrome | Edge | Firefox | Safari | |
---|---|---|---|---|
Android | ✓ | - | ✓ | - |
iOS | * | - | * | ✓ |
Linux | ✓ | - | ✓ | - |
macOS | ✓ | - | ✓ | ✓ |
Windows | ✓ | ✘ | ✓ | - |
* Chrome and Firefox for iOS do not have access to WebRTC APIs, unlike Safari for iOS.
npm install twilio-video --save
Using this method, you can require
twilio-video.js like so:
const Video = require('twilio-video');
Releases of twilio-video.js are hosted on a CDN, and you can include these directly in your web app using a <script> tag.
<script src="//media.twiliocdn.com/sdk/js/video/releases/2.0.0-beta2/twilio-video.min.js"></script>
Using this method, twilio-video.js will set a browser global:
const Video = Twilio.Video;
The following is a simple example for connecting to a Room. For more information, refer to the API Docs.
const Video = require('twilio-video');
Video.connect('$TOKEN', { name: 'room-name' }).then(room => {
console.log('Connected to Room "%s"', room.name);
room.participants.forEach(participantConnected);
room.on('participantConnected', participantConnected);
room.on('participantDisconnected', participantDisconnected);
room.once('disconnected', error => room.participants.forEach(participantDisconnected));
});
function participantConnected(participant) {
console.log('Participant "%s" connected', participant.identity);
const div = document.createElement('div');
div.id = participant.sid;
div.innerText = participant.identity;
participant.on('trackSubscribed', track => trackSubscribed(div, track));
participant.on('trackUnsubscribed', trackUnsubscribed);
participant.tracks.forEach(publication => {
if (publication.isSubscribed) {
trackSubscribed(div, publication.track);
}
});
document.body.appendChild(div);
}
function participantDisconnected(participant) {
console.log('Participant "%s" disconnected', participant.identity);
document.getElementById(participant.sid).remove();
}
function trackSubscribed(div, track) {
div.appendChild(track.attach());
}
function trackUnsubscribed(track) {
track.detach().forEach(element => element.remove());
}
See CHANGELOG.md.
Want to enable CSP in a way that's compatible with twilio-video.js? Use the following policy directives:
connect-src https://ecs.us1.twilio.com wss://endpoint.twilio.com wss://sdkgw.us1.twilio.com
media-src mediastream:
If you're loading twilio-video.js from media.twiliocdn.com,
you should also include the following script-src
directive:
script-src https://media.twiliocdn.com
Keep in mind, you may need to merge these policy directives with your own if you're using other services.
See LICENSE.md.
Fork and clone the repository. Then, install dependencies with
npm install
Then run the build
script:
npm run build
The builds and docs will be placed in the dist/
directory.
Bug fixes welcome! If you're not familiar with the GitHub pull request/contribution process, this is a nice tutorial.
FAQs
Twilio Video JavaScript Library
We found that twilio-video demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.