Skip to content

Instantly share code, notes, and snippets.

@giapt
Created August 24, 2019 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giapt/86267c817dcc3450684f561660733c24 to your computer and use it in GitHub Desktop.
Save giapt/86267c817dcc3450684f561660733c24 to your computer and use it in GitHub Desktop.
import { Component } from 'react'
const confOptions = {
enableTalkWhileMuted: true,
openBridgeChannel: true
}
const options = {
hosts: {
domain: 'meet.jit.si',
muc: 'conference.meet.jit.si' // FIXME: use XEP-0030
},
bosh: '//meet.jit.si/http-bind', // FIXME: use xep-0156 for that
// The name of client node advertised in XEP-0115 'c' stanza
clientNode: 'https://meet.jit.si/jitsimeet'
}
let connection = null
let isJoined = false
let room = null
let localTracks = []
const remoteTracks = {}
var localUserId = null
var ownerJitsiId = null
class Call extends Component {
constructor (props) {
super(props)
this.state = {
users: []
}
}
onConnectionSuccess () {
room = connection.initJitsiConference('conference', confOptions)
}
onConnectionFailed () {
console.error('Connection Failed!')
}
disconnect () {
console.log('disconnect!')
}
onDeviceListChanged (devices) {
console.info('current devices', devices)
}
initCall () {
const initOptions = {
disableAudioLevels: false,
// The ID of the jidesha extension for Chrome.
desktopSharingChromeExtId: 'mbocklcggfhnbahlnepmldehdhpjfcjp',
// Whether desktop sharing should be disabled on Chrome.
desktopSharingChromeDisabled: false,
// The media sources to use when using screen sharing with the Chrome
// extension.
desktopSharingChromeSources: [ 'screen', 'window' ],
// Required version of Chrome extension
desktopSharingChromeMinExtVersion: '0.1',
// Whether desktop sharing should be disabled on Firefox.
desktopSharingFirefoxDisabled: true,
disableThirdPartyRequests: true
}
JitsiMeetJS = window.JitsiMeetJS
JitsiMeetJS.init(initOptions)
connection = new JitsiMeetJS.JitsiConnection(null, null, this.options)
}
async componentDidMount () {
console.log('JitsiMeetJS', window.JitsiMeetJS)
this.initCall()
}
render () {
const { users } = this.state
return (
<div className='call-component'>
abc
</div>
)
}
}
export default withRoom(Call)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment