I’m not receiving a streamCreated event for participants already connected so only older participants can see newer ones and not vice versa. I’m on versions 2.12.0 both on browser and server.
Has anyone experienced similar? Any workarounds?
My react code below
handleJoin = () => {
// this will render the divs and then connect video to those divs
this.setState({ joined: true }, () => {
this.connectVideo()
})
}
connectVideo = () => {
this.OV = new OpenVidu();
this.OV_session = this.OV.initSession();
axios.post(`/rooms/${this.props.currentRoom.id}/video_token`).then(response => {
const { token } = response.data
this.OV_session.on('connectionCreated', event => {
console.log('found connection', { event })
})
this.OV_session.connect(token)
.then(() => {
console.log('success')
this.startStreams()
this.startPublish()
})
.catch((error) => {
console.log('Error connecting to OpenVidu session', { error })
})
})
}
startPublish = () => {
this.OV_publisher = this.OV.initPublisher(
undefined,
{
audioSource: undefined, // The source of audio. If undefined default audio input
videoSource: undefined, // The source of video. If undefined default video input
publishAudio: true, // Whether you want to start the publishing with audio unmuted or muted
publishVideo: true, // Whether you want to start the publishing with video enabled or disabled
resolution: '640x480', // The resolution of your video
frameRate: 30, // The frame rate of your video
insertMode: 'APPEND', // How the video will be inserted according to targetElement
mirror: false // Whether to mirror your local video or not
},
(error) => { // Function to be executed when the method finishes
if (error) {
console.error('Error while initializing publisher: ', error);
} else {
console.log('Publisher successfully initialized');
}
}
);
this.OV_session.publish(this.OV_publisher)
this.OV_publisher.addVideoElement(this.publisherRef);
}
startStreams = () => {
this.OV_session.on('streamCreated', event => {
console.log('streamCreated', { event })
this.OV_session.subscribe(event.stream, 'remote-streams-v2', {insertMode: 'APPEND'});
});
}